Thanks for your query. Based on the facts that you have posted it appears that you have developed infection of the glans penis
called as Ballanitis.
Please take broad spectrum antibiotics like Cefotaxime
along with anti inflammatory drug like Diclofenac
twice daily. Ensure to clean your genital with warm water twice daily.
I think it should get resolved in 10 days.