Refrain from having bareback anal sex will prevent you from having UTI
As for fungal infection need to upkeep personal hygiene @ groin area and do not use those mildew infected water bed or inflatable mattress
Powder bath and broad spectrum anti fungal cream can heal or prevent