I would definitely go to see your primary care doctor
about this issue. Erectile dysfunction
, as you have pointed out, can sometimes be a sign of another underlying medical problem, and a full medical evaluation is definitely in order.
I think a key question to sort out is whether or not you are still waking up with some erections in the morning. It is unclear from your question if you have lost morning erections entirely or if they have just decreased in frequency. I stress this point because if you still have some morning erections, then this is a positive sign because it indicates that all of the "machinery" that leads to erection is still working well in your case. Most young men who don't have any other major medical problems (like, say, diabetes) don't need any detailed medical workup for erectile dysfunction as long as they are having erections occasionally.
I think it is unlikely that the issue with your foreskin is causes a problem with erectile dysfunction, but your doctor will be able to take a look and figure out whether this might be contributing. Finally, the most likely cause of your erectile dysfunction is anxiety
or stress, as you also point out, and your doctor will be able to help you figure out if this is the case and, if so, what could be done about it.