To throw in one more perspective (not to dismiss the other answers in any way), I think there is indeed wide variation and heavy overlap for these words. However, "cup" is probably more versatile.
The OED definitions overlap significantly
Here are the relevant Oxford English Dictionary definitions of "glass":
II. Something made of glass.
4. a. A glass vessel or receptacle. Also, the contents of the vessel.
5. spec. A drinking-vessel made of glass; hence, the liquor contained, and (fig.) drink.
But it supplies this telling note:
The specific application as in sense 5 is now so predominant that the word is now commonly applied only to vessels more or less resembling a drinking glass [...]
Meanwhile, here is the relevant definition of "cup":
I. A drinking-vessel, or something resembling it.
1. A small open vessel for liquids, usually of hemispherical or hemi-spheroidal shape, with or without a handle; a drinking-vessel. The common form of cup (e.g. a tea-cup or coffee-cup) has no stem; but the larger and more ornamental forms (e.g. a wine-cup or chalice) may have a stem and foot, as also a lid or cover [...]
One definition further down includes the wonderful "applied to various cup-shaped contrivances".
I think these entries serve to show us just how variable these words are: On the one hand "glass" is applied to "vessels more or less resembling a drinking glass", and on the other hand "cup" is applied to "a drinking-vessel, or something resembling it"! If you were to draw a Venn diagram of these definitions, there would be significant overlap of things that qualify.
However, if one were to be the broader category, it would seem to be "cup", which the OED only qualifies as "for liquids", whereas it takes the time to mention the material of a "glass". (But note that using the material as the main factor does not agree with several users' intuitions!)
Asking for a glass of water
Another of the definitions for "cup" is "drink; that which one drinks", not unlike "contents of the vessel" for "glass".
This suggests that both terms are also easily connected not with the object itself but with what's contained in it (synecdoche). Hence, a "glass of water" and a "cup of water", besides the literal meanings "a glass that is full of water" and a "cup that is full of water", could indeed be taken to refer to the same thing instead: the water that one would put in a cup or glass.
If you're wondering what's better to use in the request "I would like a ____ of water," I'd say it depends most on the establishment. At my local coffee shop, I ask for a "cup of water" knowing that all beverages are in plastic or paper cups, but I would get it in one of those even if I asked for a glass. At a sit-down restaurant, I'd ask for a "glass of water", but again I'd receive a glass vessel even if I asked for a cup. In a friend's home I'd ask for a glass by default, and could receive either vessel.
Note that for whatever reason, "glass of water" is far and away the more common collocation on Google Ngrams (source).
Whether this is because the phrase has just become fixed or because water tends to be served in glasses I don't know.
What these words mean to different people
However (and this is one pitfall of any dictionary), the fact that these words can apply to an object doesn't mean that they are typical of an object. What's worse, everyone will have a slightly different understanding of what that most typical specimen is.
There's a good type of study for this sort of question, though it's not exactly a lexicographical one so much as it is a psycholinguistic or semantic mapping one. The design is simple. You ask a bunch of people to rank various specimens of a type according to how "typical" they are of that type. You might show them a circle where the centre represents the ideal specimen and the outer edges are for unusual specimens and let them place the objects on that diagram. Then you take the average response and use that to determine what the key qualities of that type are.
For example, with birds, penguins tend to be placed on the outer edge, and red-breasted robins in dead centre. If we look at enough specimens we might conclude that what most people think of when they think of a bird is a small singing bird capable of flight that digs worms out of the ground, builds nests out of twigs, and migrates for the winter. Of course, in places where robins are less common than, say, parrots, the parrot's qualities will tend to define people's idea of an ideal bird.
I don't know if such a study has been carried out on cups, glasses, and other vessels such as mugs, steins, and tumblers. But it would be very interesting for your question to see how they're classified by people of different generations and geographical locations. But it wouldn't settle any arguments. ;)
For example, just reading over this thread, we see that according to various people the key qualities, the vectors by which we categorize these things, are widely in dispute!
The height and thinness are the determining factors, but also transparency and whether the vessel is used to hold liquor (@LawrenceC)
The intersection of the material and whether it has a handle determines the name (@fixer1234)
The material is "technically" the determining factor (@EDevinVanderMeulenII)
It seems to be dependent on the beverage the vessel is intended for (@JimMacKenzie)
Material, shape, and quality as a heat insulator are all factors (@Peter)
One category is a hypernym of the other; all glasses are technically cups (@cjl750)
Hence, we're not going to find one definition that suits everyone, even in one region, even in one family (I disagree with my parents over the things these words apply to). It's very much a matter of subtle associations. I suspect that the more everyday categories (cups, chairs, birds, rooms, animals, professions) are all highly subject to variation by individual discretion.
At the end of the day, if you're not confident about your own judgement, use what people around you are using. Also, questions like this make for fun topics in groups of linguistically inclined people: "Hey, would you call this a 'cup' or a 'glass'?" Then watch the feathers fly. :)