A) A method of escape, when reality has too much suffering and people want to temporarily free themselves from that existence.
B) A method of new experience, when reality is a bit too boring and people want to go somewhere exciting.
Method B is what generally leads to sudden deaths due to the nature of the drugs e.g. cocaine, MDMA/ecstasy, speed