Maybe you are too tired. Sometimes my eyes go out of focus when I am too tired. And they hurt too. Besides, I also can't focus my mind. But these symptoms will disappear after I have a good rest. So maybe you also need to have a good rest if you feel tired.
I don't know what this is called.However, if you are not diabetic or have high blood sugar, a very likely reason may be dehydration - easiest cure will be to drink large amount of water and learn to always keep your body hydrated. High sugar? you are still lucky your body mechanism is directly telling you your sugar level is creeping up due to a recent consumption of high sugar. Generally this tapers off as your sugar level starts to decrease and your vision improves again. Obtain a glucometer and test your sugar level when the eyes start to feel blurry. See a doctor
Maybe you are tired or you are drunk, since I have the same problem once I am tired enough and drunk. If you do not have these problem, it may be caused by the eye problem. So please go to see a doctor immediately.