Find a therapist you like. Not because of any mental heath issues, but because I guarantee you that they will save you more money than they cost you by a long way. The right therapist will be able to ask you the right questions to help you figure out what to do next, and even make helpful suggestions.
This is absolutely not the same as talking to a friend or partner. It is their job to use their experience help and advise you. They are entirely in your corner with you, just like you would expect from any professional.
Part 2
Perhaps a different perspective – I've been freelancing/contracting since I was about 22, and I'm now 37. Full stack, but leaning heavily towards backend given the chance. My latest contracting role is actually as a network engineer (which I gained the knowledge for because I started an ISP during the pandemic).
I've not encountered any issue with nearing my 40s. I think the three key things are: be a good communicator, be comfortable talking about money, and doing your job well. All three are equally important, and you can probably get by with only two.
I've always worked in either small companies, or in very small (or solo) teams within a larger company. I know that I excel in that environment, so that is what I stick to.
But if you really do hate technology, then perhaps it is time to find something else. Again, the therapist will really help so much with this.
Happy to talk more about any of this.