Anal, condom necessary??

Is it necessary for a guy to wear a condom so he doesn't get a uti or just peeing afterwards will prevent it?