Welcome to Health care magic Forum.
Accoding to your description your condition appears to be a "Acute on chronic anal fissure" . You can try Lignocaine gel 2% its a topical anaesthetic has to be applied inside of the anal canal
twice daily and it relieves pain.
Drink plenty of water as it will loosen the stool and increase the fibers in your diet like beans ,green leafy vegetables etc
Consult a General surgeon
for examination and for the permanent solution.