Human cognition or sensing what is happening is part of phenomenology or the science of phenomena rather than of being.
The effects known as out-of body experience [OBE] and near-death experience [NDE] are quite separate effects but share some features. Folk who report that they were near to death, say that as a result of being involved in a road or other accident but who survive, often report the experience of having their whole life flash before their eyes like a film at high speed.
Others who may perhaps be ill and even expect to die lying in their beds report a sense of calm and well being followed by the appearance of a bright light to which they feel drawn. Some of those people also report meeting up with loved ones and relatives. In those instances they are usually robed in white cloaks and surrounded by an intensely white golden light.
The feature which is shared by NDEs and OBEs is that the subjects sense a detachment from themselves. Occasionally someone , say on an operating table may have a near death experience and then have an out of body experience. However, there the connections go no further.