I have experienced this too. What I have found out over the years that in my case it appears to be hydration related.
It does not happen on rides less than 25 miles but when I go over that if my neck starts to hurt, I know I am starting to bonk. I've done 3 centuries being a clyde and over 60 and none of them caused my neck to hurt. I've had a couple of professional bike fits so I don't think it is that either.
It seems for me that when it gets hotter out and I don't drink enough this is what happens. As I said, when this begins, I know my day is coming to an end and I'll just have to limp home. Seems after I get home, I then have to drink a lot so I am thinking it is related to hydration.
john