That sounds like the start of a urinary tract infection. https://www.webmd.com/men/urinary-tract-infection-in-men If it continues, see your doctor. They'll do a urine sample to check for bacteria and then treat you with antibiotics. Fairly common and gets better quickly once treated.
You sound pretty young, but this is also a sign of a prostate problem. I'd see a doc.