Dehydration. While these symptoms could be explained by a variety of different things, it might be that you are simply more dehydrate at times than at others. Since the symptoms do not happen all of the time, it makes it a bit more challenging to pin point where the problem could be. You could start by ensuring that you are well hydrated, drinking plenty of water each day. I hope this helps clarify this.
See neurologist. You need to be evaluated by a neurologist. It could be musculoskeletal with referred pain frm the neck, but could also be something pressing in the brain, . You might need MRI of brain. Start with neurologist.