hi there, the symptoms you have described are suggestive of anal fissures and the treatment for it is first to apply lignocain jelly to the anus 15 mins before going to the loo, secondly you need to take mild laxative to relieve you of constipation
as that is the most common cause of anal fissures. You need to include lots of fruits and fibrous vegetables in your diet to avoid being contipated. Drink plenty of fluids adn avoid refined foods. You could try taking Sitz bath or warm bath in a tub to relieve you of the pain and for the fissure to heal. Proper high fiber diet along with plenty of water or fluid and regular bowel movements
will help prevent it in future.