There is no absolute distinction. It is just a convention of usage.
- 잔 = sounds more formal than 컵. So there are traditional words like 술잔 and 찻잔, but no 술컵 or 차컵. (for water and coffee, both are used, like 커피잔/커피컵, 물잔/물컵, but 컵 seems more common for water). 잔 roughly corresponds to "a glass" in English.
- 컵 = less formal and more practical, like "cup" in English. A trophy cup (as in World Cup) is also translated to 컵 (like 월드컵).
While they are often interchangeable, 잔 tends to be preferred for formal and ritualistic situations, such as wine or liquor drinking for example (컵 is rarely used for alcoholic drinks).
컵 is suitable for more practical use in an everyday situation. For example, the common plastic and paper cups are always called 플라스틱 컵 and 종이컵, never 잔 (종이잔 would sound very funny).