Prevention

Okay, so my question is, how can you prevent (the best way possible) from getting a UTI? I tend to overthink and have the mindset that if I have sex I'm going to get STDs and get pregnant and all that stuff (which I dont want)