Sorry you have an irritated penis. It happens though and no, I don't think it is serious other than being a pain. You can always see your regular doctor for this if you want to get in more quickly. Masturbating is going to irritate it but not harm you and sex should be fine.
It could be balanitis. It's an infection or allergic reaction of that area and a topical ointment would clear it up. But that is a lot more common with uncircumcised penises. You can get a yeast infection of the penis too. Easy to clear up.
Here is an old post where a MedHelp doctor weighed in and recommended 1 % hydrocortisone cream for the area on a post somewhat like yours. https://www.medhelp.org/posts/Dermatology/Red-Irritation-on-Shaft-of-Penis/show/242541
But personally I'd check in with your general doctor but would not be afraid of anything serious. Just want to get it cleared up as soon as possible.