As per your history it seems to be anal fissure, which is most common due to hard stool.
If you have constipation alternates with diarrhoea then it points to irritable bowel syndrome.
If u want can get it examined by a general surgeon
Next Steps
For fissure regular sitz bath.
Laxatives use.
Diltiazem ointment per ano.
Fiber rich diet.
Plentof fluids.
Lifestyle modification will help u a lot if done seriously.
Health Tips
Restrict mutton, spicy food consumption.