This sounds like what I have which took awhile to diagnose and you should definitly see an MD to rule out things like hernias, kidney stones and celiac disease.
It turned out that I have IBS of the constipation type. As someone else mentioned straining led to pelvic floor disorder which presented as chronic prostatis (no infection so antibiotics dont help). The IBS led to pain in the scrotum while the prostatis resulted in pain at the tip of the penis.
After seeing an MD and ruling out more serious stuff you want to rule out triggers for the IBS through an elimination diet. I discovered that gluten which had never been a problem now was. NSAIDs are problem for me too so no aspirin, ibuprofen or naproxen. (tylenol/acetaminophen is ok but never take more than indicated on the bottle) Also consume lots of fiber and liquid.
This treats the IBS and prevents the prostatis from getting worse.
The thing that has helped make the prostatis better is physical therapy. There are clinics that provide this for women and it includes external and internal trigger point myofascial work combined with biofeedback training so you stop tensing your pelvic floor muscles. Some clinics provide this for men. The internal work sounds intimidating guys but if the pain has gotten to the point where you are checking this board its worth it. YOU CANNOT DO THIS ON YOUR OWN. Most general practitioners are unaware of this but urologists are generally aware of clinics that can do this.
It will take some time but this can all get better.
I wish you all the best of luck.