Bactrim while pregnant

Allie • Lost but not forgotten 03/08/16 Blessed with a beautiful baby girl🌸 Team Save The World 🌎 ♻️
So my doctor gave me some UTI pills "Bactrim" and I just found out I was pregnant. I didn't know I was when I took them. It didn't hurt the baby because I'm now 17 weeks. I just recently got another really bad UTI and I can't afford to go to the ER right now and I had a few left over so I took one. My doctor said it was safe but when I looked it up...people were saying it's not okay and others were saying it was. Just need an opinion and hoping I didn't make a mistake by taking one. Thanks!