Simply put, drugs affect how neurons in the brain process, send, and receive signals. They disrupt the normal functions of the brain's activity. Drugs increase or decrease the number of neurotransmitters that are spread. Depending on how the drug is administered, its chemicals will reach the brain by way of the bloodstream in a matter of seconds, minutes, or hours. When they reach the brain, these chemicals must bypass the blood-brain barrier, which their specific chemical composition allows them to do.
Chemicals from certain drugs will attach to certain neurons and activate them by mimicking the chemical signals of naturally occurring neurotransmitters. This results in abnormal neurotransmissions that affect perceptions and feelings. This is the case with opioids and cannabinoids.
There are also drugs that cause certain neurons to release an abnormally high amount of naturally occurring neurotransmitters. This is how cocaine and MDMA affect the brain. Other drugs inhibit neurons or chemicals in the brain from reabsorbing certain neurotransmitters. For instance, certain anti-depressants work by preventing neurons from reabsorbing serotonin.
There is much about the effects of psychedelics that are still unknown. However, they seem to work by blocking the release of the serotonin. They also impact the neural circuits that regulate perception and the regulation of behavior.