For me it's weightlifting, specifically strength training (not bodybuilding) which includes mobility exercises and certain types of exercises that strengthen the muscles that are underworked when sitting for long periods. On example is the serratus anterior. Having a serratus that doesn't work properly leads to numerous shoulder-related problems and back pain. It's all sort of connected.
Stretching is only half the battle. One must stretch the correct muscles (the ones that are too tight, like the pecs and scalenes) and strengthen the ones that are loose and weak (like the rhomboids, serratus and others).
If pursuing weightlifting, which I highly highly recommend, I recommend a real trainer (not most half-baked ones you see in gyms), and spending a lot of time specifically nerding out on exercise physiology, even physical therapy. There are some very good YouTube channels - one of my favorite is Calisthenics Movement.
One simply cannot work in an office or at a computer workstation and expect not to have the body pains of a coal miner by the time you hit your 40's without balancing out muscular strength and joint mobility that you lose by doing this.
Much of strength training, a lot of people are surprised to know, involve neurological connections created simply using muscles in movement patterns that are new. It's very similar to the way you learn proprioception (standing on a skateboard, surfboard, or a subway car without holding onto anything). In the same way, muscles get stronger simply because more fibers are recruited, due to repetitive motions. In the early stages, this is much and perhaps most of the 'gains' in strength.
It's getting late and I've fallen into a rabbit hole. In short, do weight training or SOME sort of mobility work (yoga, pilates, whatever) if you work at a computer for a living. These random HN messages can save you thousands of dollars of future medical bills / PT bills and incalculable discomfort.