Rectal or anal pain has many causes.

Hemorrhoidsanal fissure (a cut near the anal opening), anal abscesssexually transmitted diseasescancerconstipationrectal 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.