once one is dying, there two place which one has to be opened to and this happens in the spiritual realm, there is barely no time lag between life and death. Darkness appears and you are open to the other world of Spirits. From there i cannot judge where people go after that.
on the medical perspective, the cerebral dies last and memory is lost and thats what we call consciousness