Get Your Dog Care Questions Answered by Experts
There is something called smegma which is normal discharge from the penis which is often white to whitish-yellow or sometimes even with a slight brownish or greenish color to it. This is of no concern, is perfectly normal, and occurs in most male dogs. It is caused by the bacteria trapped underneath the shaft, and rarely spreads or causes a problem. Most dogs lick it off before it is noticed.
The time to consider it being related to a penile or urinary tract infection is when it leaks from the penis, comes out in larger amounts, or you notice your dog straining to urinate, drinking more water, or excessively licking this area and causing raw skin there. Just keep an eye on his urinating for the next couple of days to make sure, but more than likely, what you are seeing is just smegma.
Best wishes, and let me know if I can help further.