It could be Fissure in Ano
,a crack in the anal region.
You should take plenty of liquids,green leafy vegetables,high fiber diet.Your stool should be soft.
You can apply ointment containing Nifedipine/Diltiazem
locally in the anus.
You should also get examined for Piles(Haemorrhoids)
Follow the above measures.
Wish you good health