Negative Thought Patterns around sex

I’ve been working on my mental health and negative thought patterns that have been affecting my sex life with my wife - feeling a bit stuck in cycles of worrying about getting it up, which then makes that issue happen, worrying that’ll upset my wife, getting into big conversations about it and ending up frustrating her. We often end up having sex after these big conversations but I want to get to the point where I’m not thinking negatively in the first place, or at least able to manage these negative thoughts better. I know there’s really nothing to worry about, but sometimes it feels like I don’t have the tools to change this pattern. Appreciate this community a lot and any similar experiences/general supportive comments would be great, and help me feel like I’m not the only one this happens to! Thanks everyone