Hello there, as per the details you provided, this must be fissure, due to hard stools, this causes a tear in the mucosa of anus that leads to bleed or blood stains with pain.
This can be treated with proper medication and dietary and lifestyle changes.
Do consult online and get prescribed.
Health Tips
Drink plenty of Water.