Piles/Hemorrhoids are usually caused due to excessive straining while passing stools.
The veins and venules sorrounding the peri anal area are inflammed and protruded out. Due to excessive pressure the bleeding may spontaneously start.
In your case we have to confirm whether you are suffering from hemorrhoids or an usual anal fissure.
Bleeding per rectum always warrants a doctor visit for further management.
Next Steps
get a complete blood work up done, Consult a general surgeon at the earliest possible.
Health Tips
Start having a high fiber diet, get a cbc, warm sitz bath can help a lot relieving the symptoms. avoid excessive straining