Probably just in case the thing that would have made us die doesn't actually make us die so we don't fully process the horrifically traumatic thing that caused us to almost die
When your brain dies, depending on what the issue is, your brain no longer works under normal circumstances.
If your heart stops, oxygen is going down, it could just mean that your brain regularitory features stop working as designed and it's firering more random.
More random / lsd / drugs can give you weird effects. Optical, sensorical etc. illusions.