Many people (I saw a 9gag post 3 days ago and couldn't find it, I'll edit later if I do find it)experience dry/hurting/overwhelmed eyes when they wake up because the light feels too bright. I happen to "suffer" the same. Why this occurs? Is it because the eyes are dry, or because the pupils are contracted, or why else?
The reflex responsible for the phenomenon you described is called the Pupillary Light Reflex. According to the Textbook of Medical Physiology, Guyton & Hall, Elsevier, 11th edition, 2005, p. 649 (reworded by me in order to avoid direct copying):
When light reaches the retina of the eye, the optic nerves are stimulated. Most of the generated nerve impulses participate in the creation of an image in the brain etc., but a few reach an area in the brain called the pretectal nuclei. These nuclei then generate secondary impulses to another nucleus called Edinger-Westphal nucleus, which sends a signal through parasympathetic nerves to constrict the sphincter of the iris. Conversely, in darkness, the reflex is inhibited, which results in dilation of the pupil.
To summarize, in darkness (either when you are in a dark room with your eyes open, or when you are anywhere with your eyes closed) the pupil will be dilated since stimulation by light does not occur. When stepping into the light or when opening your eyes, light immediately stimulates the optic nerve, which causes a signaling cascade that results in constriction of the pupil to a certain size, depending on the amount of light present (primarily to protect it from exposure to too much light).
Naturally, you can see this constriction happening every time you open your eyes in front of the mirror (focus on the pupil). It was also depicted rather accurately in the end of Disney's excellent rendition of the Hunchback of Notre Dame (skip to 1:22).