It is likely that you are suffering from prostatitis - inflammation of the prostate. The prostate gland is situated just below the bladder. The urethra, which is the tube through which urine and semen comes to the tip of the penis passes through it. Any infection and inflammation of the prostate gland is thus referred to the penis and will be felt as a pain or burning sensation.
The sensation may be more just after or before sex, or after handling the penis after masturbation.
Another cause of the pain and the sensation could be a penile fracture.
A penile fracture is an injury to a thick membranous covering inside the penis called the Tunica Albuginea. The injury occurs if the penis receives a sudden jolt in the erect state.
Penile fracture should be treated as early as possible. As an immediate measure, you need to apply a cold pack over the penis, support it so that movement is restricted and take painkillers like Motrin 500mg. But if you really have had a penile fracture, you need to consult a doctor for an early examination. You may need a surgical repair of the injury.
To know more, please see:
Please consult your doctor for a urine test as well as examination of the prostate for any inflammation.
I hope this helps.
Let me know if you need more input. If not, please click on the green"Accept" button on this page. A positive rating and adding a bonus will be warmly appreciated.