While succint, this is the best comment I think of the thread. The suboccipital muscles getting tight, weak scalenes that get too tight while opposing structures get overstretched, and one more to add: shoulder posture and dysfunction contribute majorly to neck issues.
What's shoulder dysfunction? Well a hunched or otherwise unusual posture that computer and phone usage encourage lead to mobility issues with the shoulder that eventually lead to joint issues too.
Relevant to the neck is the fact that the scapula attaches to the neck at multiple points and can contribute majorly to a situation where the neck muscles are overstretched or overtightened perpetually, and in a hypertonic state.
Yes, pull-ups and gym are great suggestions (although push-ups are not a great suggestion as they can contribute to chest tightness and forward shoulder positioning). But as someone experienced in suffering as well as the gym, my message is it's a hella lotta more complex than mentioned in these threads.
Oh and eye alignment issues can contribute. If your eyes don't align you might stare at your screens in a tilted way...
This will be a pandemic in 10-20 years, as a high percentage of the population will be affected.
I'm middle-aged and an IT guy, so I'm unfortunately the future. I cared little what was happening to my vertebrae and shoulder complexes in my 20s.