The real or perceived proximity to death often results in a non-ordinary state of consciousness characterized by phenomenological features such as the perception of leaving the body boundaries, feelings of peace, bliss and timelessness, life review, the sensation of traveling through a tunnel and an irreversible threshold. Near-death experiences (NDEs) are comparable among individuals of different cultures, suggesting an underlying neurobiological mechanism. Anecdotal accounts of the similarity between NDEs and certain drug-induced altered states of consciousness prompted us to perform a large-scale comparative analysis of these experiences. After assessing the semantic similarity between ≈ 15,000 reports linked to the use of 165 psychoactive substances and 625 NDE narratives, we determined that the N-methyl-D-aspartate (NMDA) receptor antagonist ketamine consistently resulted in reports most similar to those associated with NDEs. Ketamine was followed by Salvia divinorum (a plant containing a potent and selective κ receptor agonist) and a series of serotonergic psychedelics, including the endogenous serotonin 2A receptor agonist N,N-Dimethyltryptamine (DMT). This similarity was driven by semantic concepts related to consciousness of the self and the environment, but also by those associated with the therapeutic, ceremonial and religious aspects of drug use. Our analysis sheds light on the long-standing link between certain drugs and the experience of “dying“, suggests that ketamine could be used as a safe and reversible experimental model for NDE phenomenology, and supports the speculation that endogenous NMDA antagonists with neuroprotective properties may be released in the proximity of death.