It may be due to Anal Fissure
or Fistula or Haemmorrhoids.
You must visit your physician to have thorough examination and to check whether MRI pelvis is needed or not for Anal Fistula
if you have take syrup. Lactulose
2 TSF twice a day to relieve constipation.
Avoid chillies to decrease the intensity of pain while defecation.
I hope I am sucessful in solving your query If you have more you can ask me.
Dr. Azhar Sattar