Why can’t I stay hard now?

Patient: Why can’t I stay hard now?I am 22 years old and I have been dating my girlfriend for 3 years. We used to have sex often. But one day we decided to stop. We didn’t have sex for a year. We picked it back up again and I performed fine. Then I stopped having the ability to keep it up. I could get hard but couldn’t stay hard. I was told to stop masturbation and porn. That worked for couple months but once again, I can’t stay hard now. I even finished only somewhat hard. It isn’t her. And I don’t have trouble urinating. I find myself now always worrying if I can stay hard. So I think it is psychological. However, when I could stay hard for those few months, I was confident and not worried, then it just stopped working.Also, if you think I should see a therapist, what kind?

Symptoms: unable to keep an erection