It's hard to say what is going on and a doctor would need to examine you. So, yes, go to the doctor when yo can to discuss this. With that said, you are 22 which makes the odds of something like cancer fairly low. And this does not sound like penis cancer. This type of cancer is actually quite rare. Doesn't mean it doesn't happen, but again, very low odds that cancer has anything to do with your situation. https://www.webmd.com/cancer/penile-cancer-overview#1 Take a look at that link (copy and paste). Here are the things that put you at greater risk of penile cancer.
Have the human papillomavirus (HPV)
Are over age 60
Have a weakened immune system because of HIV or AIDS
Aren’t circumcised. Fluids and a thick buildup called smegma can collect under your foreskin and might make cancer growth more likely.
Have a condition called phimosis, which makes your foreskin tight and tough to clean. It can also lead to fluid buildup.
Had psoriasis treatment with the drug psoralen and ultraviolet (UV) light
Any of that sound like you? Please know that penile cancer also has other symptoms typically that would be present.
But since you have a lump, get it looked at. https://www.healthline.com/health/mens-health/lump-on-penis There are possible causes. And it could even be something like a blemish. Peyronies disease is scar tissue that builds up, so that is a possibility.