It could be Balanitis Xerotica Obliterans (BXO) aka Lichen Sclerosus Photos (LS). I have it and it's not fun. See a urologist without delay.
You should get this checked out by your doctor but it could be lichen sclerosis. This causes white patches on the penis. Are you circumcised? More common in uncircumcised men. If that's what it is, your doctor will likely prescribe a steroid cream to apply to the area. There's also something called fordyce spots that can be along the shaft and are yellow or white. These are common and harmless. https://www.medicalnewstoday.com/articles/256918
This could be an infection called balanitis. If it's causing problems retracting your foreskin and affecting your erection, it's definitely time to see a doctor about it. It could cause something called phimosis, which is the inability to retract your foreskin at all, which might require surgery. Go now, so this can be treated with a cream instead.
Balanitis can be caused by either a fungus or bacteria, so don't try to treat it yourself. If you use the wrong kind of treatment, you could make it a lot worse.
It's not as common, but it could also be lichen sclerosus, which also needs a doctor to treat it.
None of this is sexually transmitted, if that's a concern.
It's very common, and easily treated if you get to a doctor now. Let us know what happens.