UTI while pregnant

Gwen
Hello ladies👶🏽
 Went to the hospital because I was cramping and started to spot. My spotting was a brown color and I only saw it when I wipe my self. So at the hospital all my labs came back normal and my HGC levels are 3847 and just last week it was 490 so while there the doctor told me I have a baby UTI and want to treat  she gave me medicine that's safe to take while pregnant but I'm still kinda of scared to take it. Have this situation happen to any of you girl?