Pain in penis after masturbation. It stops after urinating. I am an uncircumcised individual is that related to the problem?

Hard to say. If you have penile pain after masturbation which resolves after urinating, most likely this represents a mild amount of urethral irritation. This can also be caused by self instrumentation (placing items in the urethra) or from compression/trauma. Foreskin irritation is possible but would not likely resolve with urinating. If it persists, see your urologist.
PAIN AFTER MASTURBAT. Pain is usully a sign of irritation or trauma.You should change your technique, use lubrication as you have to retract your foreskinuse petrolatum base lubricant.Pain can also be due to persistent erection if you still get pain after masturbation, see your doctor or a urologist.