Consuming drugs and alcohol can lead to addiction that can destroy your physical and mental health. Staying away from drugs and alcohol is the only way to positively prevent drug addiction.
That being said, some people get addicted to drugs, such as painkillers, because they were prescribed the drugs for an injury or surgery. These people didn't use drugs for recreational purposes. They took drugs as a medical necessity, and tragically developed an addiction.