Rectal or anal pain has many causes.
Hemorrhoids, anal fissure (a cut near the anal opening), anal abscess, sexually transmitted diseases, cancer, constipation, rectal prolapse, pruritis ani.
Pain that becomes worse during and after a bowel movement may be an anal fissure.
A painful lump is usually a thrombosed external hemorrhoid or an anal abscess.
A dull ache with discharge may indicate a sexually transmitted disease.
A dull ache without a discharge may be cancer.
Because there are so many possibilities, you should seek the advice of a trained physician.