I can't say of course what is the matter with him but obviously something is wrong. Can you, very gently take a good look at his penis, to see if there are any obvious cuts or sores there? They may be just inside so look carefully. But if it hurts him don't.
How is his condition generally? Is he quite well in himself? And does it hurt him to pee? When he does a poop, does it come out normally or does he strain, and the stool comes out looking like a squashed sausage? That might sound like an odd question, but it can show there is swelling in the Prostate Gland.
Because of his age you probably won't want to put him through any invasive tests etc. But you could certainly take a sample of his urine and get the vet to send that for analysis. Yes there will be lots of blood cells in it but it is also possible your dog may have a urinary infection.
If so, that can be (usually easily and quickly) cured with a course of antibiotics.
There are other possibilities, such as polyps, stones or crystals in his bladder. Kidney stones is another possibility but that would quite often cause pain and a reluctance to eat plus possibly fever.
There may be non-invasive ways of treating bladder stones, but you will have to ask your vet about that.
As far as diagnostic techniques go, the least invasive are blood and urine tests, and ultrasound scans.
Another possibility is he may have some inflammation or problem with his Prostate Gland.
If by any chance what the vet discovers, in his estimation requires surgery, then it will be your decision what to do for the best, taking his age and health at the moment into account.
If he is generally strong and quite well, and his medical history/blood results/heart/breathing etc are all okay he might even be fit for surgery, even at his age. But that is up to you, as you know him best.
Vets will alwyas run a good health check on any dog before considering surgery.
There ARE always risks involved though and an older dog is at greater risk from complications either during surgery or after.
So my feeling -if he were my dog -would be to try non-invasive methods of diagnosis and treatment first.