Before I give my opinion on this, there's a caveat: I actually have technically had a near-death experience that was probably enough to produce some kind of altered state, but I'll never be able to confidently say I remember anything about it. It happened literally as I was being born, so, yeah. They say I came out suffocating to the point that I had turned blue, but obviously it turned out okay somehow (I'm not sure what they actually did for me). Interestingly, my parents say the doctor said I was the calmest baby they had ever seen. I've done some research into this subject as well and found that, intriguingly,
it has been shown that that in mice, arousal from sleep caused by suffocation is mediated by activation of 5-HT2A receptors following carbon dioxide increasing the acidity of the brain and activating chemoreceptive serotonin neurons. However, for what it's worth, it seems likely that the effect is still caused by serotonin itself, not DMT. That being said, carbon dioxide itself is actually entirely established to have psychedelic-like properties when inhaled in large dosages alongside oxygen to keep the brain alive - a mixture that was known as Meduna's Mixture or just carbogen which was used in early psychedelic therapy to test if someone was ready for an experience like LSD - and if you read experience reports of carbogen, it sounds a lot like something that is not quite fractally or mindfucking like a classical psychedelic but is still at least maybe something like a more colorful, developed, and immersive form of nitrous oxide, and people have described things like returning to childhood scenarios or seeing angels alongside more abstract inner journeys. Serotonin itself doesn't usually produce things like fractals or a classical psychedelic mindfuck but of course does otherwise still overlap significantly in its receptor activations with psychedelics and is still known to be hallucinogenic in very large concentrations like the delirium experienced during serotonin syndrome, so perhaps it is still playing some role, maybe along with things like the NMDA receptor antagonism caused by the carbon dioxide (which it is known to do indirectly) modulating the experience and also making it more out-of-body.
According to what I've read in my research, it's not uncommon for people who have experienced dissociative near-death experiences on the level you're asking about to continue being more open to having spontaneous dissociative experiences in their life after that, including communicating with "entities" or "spirits" that they recognize from their near-death experiences. If I did actually have such an experience when I was born, even if I can't really remember it, it's possible my anecdotes from later in life are tainted in that way, with that kind of stuff only coming to me readily in other ways now because I already went through that kind of thing back then, but I also can't know that for sure. Just to put it out there though, I never actually even considered that something might have happened to me in that moment at all until it appeared to spontaneously come back to me in the aftermath of a powerful psychedelic trip, when I was still psychologically in pieces and suddenly felt like I was flashing back to that moment, and could feel sensations like the fear of going into the black void others have mentioned, as well as what seem like brief memories of visions of what seem like somewhat stereotypical demonic creatures around me, although when I try to think about it, it gives me the impression that they were most likely, if anything real at all, just the people standing around me in the delivery room. I later came to realize that it was very reminiscent of the feel of this music video, and honestly is probably not that uncommon for people to have lingering in their subconscious because suffocating while being born is not terribly uncommon.
I wanted to bring this up because the trip that caused that apparent flashback is actually the same one that I associate as being the trigger for a later psychotic break, and I wanted to talk about how my psychotic episodes have been near-death experience-like, but it seemed unfair to do so without pointing out that it's at least possible that that's because I've literally had a near-death experience before, even if I'll never be able to remember it with confidence because even though I have some apparent flashback memories, I was just too young at the time (as young as possible) so I'll never be able to verify them. Now that being said, regardless of whether or not my psychotic episodes have been influenced by a past near-death experience, I do think it's notable that they've been highly similar in many ways to the most stereotypical near-death experiences as well - more so than some actual near-death experience accounts I've read before - despite the fact that they definitely had nothing to do with me dying at the time. In fact, if you read around it's not hard to find medical resources that list oxygen deprivation experiences at birth as a possible risk factor for things like schizophrenia and bipolar disorder later in life, so it seems like a lot of things we consider "psychotic episodes" in general may be linked to this phenomenon of near-death experiences at birth causing susceptibility to dissociative events later in life if that really is a thing that's going on here, and again, those psychotic episodes experienced later in life clearly have nothing to do with the person actually dying, and yet you can still see the phenomenological overlaps. While it is true, for instance, that DMT is far more "psychedelic" than a near-death experience is generally described to the point that they seem dissimilar when you are only comparing one to the other, if you compare both of them to, basically, literally anything else a human being can ever experience, except for other similarly powerful drugs like ketamine and salvia, it still becomes clear that there is nothing else even remotely as similar to a near-death experience as they are, despite their differences, and to me this also seems to hold true for certain types of psychotic episodes, which often include overtly religious themes like communicating with angels or believing yourself to have been given a divine mission in life.
From what I can determine, I think this is likely basically all because what we think of as the "near-death experience" experience doesn't inherently have anything to do with death, but rather is just the subjective consequence of the activity state the brain enters during situations of extremely high stress. Theoretically, this would explain why most hallucinogenic drugs that are claimed to resemble near-death experiences are ones that have also been associated with working through some of the same neural pathways involved in stress responses, and why mental disorders that seem to distort the same systems can also sometimes produce overlapping subjective experiences which may be in part or at least in some cases because of the brain already having been sensitized by natural experiences hyperactivating those pathways in the first place, and why "near-death experiences" as the name implies don't actually require you to die, but just to get close enough that your brain enters an extremely high state of stress, which of course is going to happen if you think you're close to dying because your brain is going to go into hyperdrive trying to figure out how to make you save yourself.
That's pretty much my thoughts on them.