What is the treatment for being constipated and having blood after passing stool ?

Sorry for the poop talk! I am freaked out, I’m a 33 F and I’ve never had this happen before.

I’ve been unusually constipated the past couple of days and I went to the bathroom and passed a stool and it had bright red blood on it. I’m confused because I didn’t strain or push hard to get it out, but it was very hard. It didn’t hurt at all. How should I proceed? Do I need to take a stool softener? There is miralax in the house that I could take, would that be helpful? I’ve never taken a stool softener before. So far I’ve just been drinking a lot of water since this happened. When do I need to go to the doctor?

Thank you!!