UTIs are not unknown in dogs, more often in bitches but not exculsively. If you can, collect some of his urine and take it with him (fresh) to your vet. Doing your own collection will avoid the need to use a catheter = risk of infection.
Don't delay because what's going on needs to be diagnosed, and treated. It could also be bladder stones, so ditto.
When he pees, after a good flow, does he squat again and only show a few drips. This is classic for a UTI.