Here's one definition of near-death experiences:
Near-Death Experiences are intensely vivid and often life-transforming experiences, many of which occur under extreme physiological conditions such as trauma, ceasing of brain activity, deep general anesthesia or cardiac arrest in which no awareness or sensory experiences of any kind should be possible according to the prevailing views in neuroscience.
Source: https://med.virginia.edu/perceptual-studies/our-research/near-death-experiences-ndes/

Many scientists accept that these experiences are real in that they occur, but only a minority would claim that these experiences correspond to a real afterlife. Many probably view them as hallucinations generated by a dying brain.

For Debate...
Are NDEs evidence of an afterlife or are they just hallucinations?
 
Are NDEs evidence of an afterlife or are they just hallucinations?
Alright.

I'll post a good debate on the topic. The best I've heard so far between Alex Tsakiris (podcaster) vs. Dr. Steven Novella (neurologist):