I have had many years worth of problems with pain in my neck, upper back and left forearm, a good deal of which has been caused by improper playing posture and addressing faulty left hand technique. It took finding an excellent and attentive teacher to finally discover this.
Echoing much of what’s been what’s been written, it may be helpful to try a guitar support that will allow you to keep both feet on the floor. I’m a big fan of Alexander Technique, but after 10 sessions I did not find it fully effective. Perhaps more would have been better, but it can be expensive.
I too have found Pilates to be most effective, particularly in alleviating my sliumping postural tendencies. Vinyoga and massage have been beneficial as well.
It may be helpful to video yourself playing. You may be able to spot some habits that contribute to your pain, but in the few years that I’ve worked with my current teacher (after 35 years of playing) I’m amazed at how much I didn’t know about problematic habits that I wouldn’t have recognized even if I had seen myself with the guitar.