hi there, you may be having a bleeding piles or an anal fissure
, tho' they are more painful. You will need to visit a surgeon and get it diagnosed and accordingly start the medication. Continous loss of blood can lead to anemia
and so you need to be careful about it. You can make a few changes in your diet to have soft stools ,like consume more of fibrous food like fruits, vegetables and salads and cut down on refined food items. You could also take some mild laxatives in the night or stool softners so that you do not have hard stools which increases the chances of injury
and bleeding. Get an opinion from a doctor as soon as possible. Take care.