You may be having fissure in ano so consult a general surgeon and proctoscopy to be done to find out what exactly it is, use ointment lox anally before defecation and take plenty of fluids orally and High fibre diet to keep stool soft, proper treatment follows according to examination report.