Hi and welcome to the forum! I am glad that I can help you.
You want to know the cause of the symptom that you experience.
Bleeding that originates from the alimentary canal can be presented as vomiting blood (in case of bleeding from the upper part of the alimentary canal as in cases of ulcers or varices esophagei), dark to black color of the feces (which indicates digested blood that originates from the upper part of the alimentary canal), dark red blood (in case of bleeding from the intestines such as in case of torsion of polyps, infection, invagination, and less common Crohn's disease and ulcerative colitis), and fresh red blood (in cases of fissures, hemorrhoids, etc).
Given the data that you described, you may or may not be experiencing hemorrhoids. This condition appears in individuals who experience constipation. You may consider seeing a gastroenterologist for further diagnosis and treatment.
Please keep in mind that I provide medical information only. I am not able to diagnose medical conditions online. Please contact your doctor or other qualified healthcare provider such as a gastroenterologist for further advice and information about diagnosis and treatment options.