Two weeks ago I had unprotected sex after two days my foreskin became really tight where I couldn't pull it past the head. There was also a lot of white discharge. Now (two weeks later) my foreskin has come looser, I can now pull it past the head, however when I'm erect it's not as easy. Sometimes I have a white discharge and now a red rash also appeared
I also think I have a swollen lymph node in my left groin
was it your first time having sex?
Looks like balanitis
This looks like balanitis, possibly caused by an infection. The timing is right, too.
I’m not sure if you meant sex with a woman or a man, but sometimes BV & thrush can cause this to irritate the penis.
I would see an STI clinic as this does appear to be an infection. Let us know the result!