I experience this occasionally. If I feel it coming on I can usually relieve it by doing “yes no maybe” stretches. I can do a set while waiting at a stoplight.
https://youmemindbody.com/disease-il...ck#mod_7886741
I also find scap pinches to help relieve this. Pinch shoulder blades together.
Interestingly, for other reasons I completely bonked on a ride last month, the neck and upper shoulders really bothered me at that time so I think they are related (at least in my case).