@QueenHawlSera Warning: long and verbose reply ahead.
If my computer's power supply was on the fritz and stopped working for a second yet my computer remained just as functional as ever during the few moments the PSU wasn't working. I'd consider that an oddity. I wouldn't say "Oh the PSU still kinda works, the fact that it completely tapped out for a solid three-minutes yet my PC stayed on is not weird at all."
While this exact scenario is highly unlikely to happen for a computer, the phenomenon behind it happens with many electronic devices (e.g. USB chargers) and it's well-known in electronics. I'm not an electric/electronic engineer (I tinkered with electronics but I'm just a DevOps), but I'll try to explain it below.
In a nutshell, electricity isn't just "inside" the wire: a field emanates around it due to the flow of electricity, the electromagnetic (EM) field. A wire conducting electricity will emanate an EM field, while the EM field can be absorbed by a wire, inducing a current through it.
This is how, for example, voltage transformers work: there are two coils (spiralling wire), labelled primary and secondary, electrically insulated from each other and wrapped around a ferromagnetic piece (the iron core). As alternate-current electricity goes back and forth through the primary coil, an EM field is emanated, which is then "chanelled" by the ferromagnetic piece to the secondary coil, where the EM field will induce another alternated current.
A "similar" thing happens inside DC (direct current) motors and loudspeakers: there's a coil around a permanent magnet, and the coil gets repelled or attracted by the magnet whenever a current passes through the coil, depending on the electric current's direction/flow (Right-Hand Rule), and this happens because the flow of electricity makes the coil to emanate an EM field, roughly speaking.
Inductors, a type of electronic component, will emanate EM fields, and they will absorb their own EM field back when current stops flowing through them, and that's the principle behind LC oscillators. Similarly, capacitors can hold plenty of charge because they're roughly "fast batteries", and that's why people were advised not to disassemble CRT televisions, because their capacitors used to hold high-voltage even after a long period of being unplugged... Similar risks and advices are found for UPSes and computer PSUs as well.
Why am I explaining this? See, powering off a device isn't something instantaneous, it takes time before all capacitors get depleted by the circuit and before all EM fields disappear. Energy can't be created nor destroyed (First law of thermodynamics), so it must be transformed, and it's often a gradual transformation, sometimes taking a few nanoseconds, sometimes taking hours to weeks (e.g. gigantic industrial apparata).
As I said initially, a PC is highly unlikely to hold enough charge to continue functioning after being cut from its main source of electricity, but it will have some charge for up to a couple of seconds due to dozens-to-hundreds of capacitors and inductors across the circuitry, as well as the EM fields emanated from its DC motors (coolers / computer fans, HDD spindle for computers with mechanical HDDs).
I'm probably digressing and ackchuallying in my explanation, but the phenomenon you described does have a fundamentum.
----
As for NDEs, I can't offer much of a scientific point about it, because I hold plenty of beliefs and uncertainties when it comes for death and The Death. I mean, while I personally believe in a "metaphysical realm" through syncretic spiritual concepts (Luciferian, Gnostic, "Thanathoeism" and "Lilitheism"), I've been leaning towards a Cosmicist Pessimistic/Nihilistic Apatheism lately: not Atheism, but "Apatheism", when the existence of deities, even when believed, doesn't really matter. I've been leaning (or trying to lean) towards the rationality and scientific explanation lately, even though I still hold some beliefs deep inside.
Deep down, I personally want to think there's nothing but ultimate darkness and nothingness after the bittersweet kiss of Death's dark-red lips, I personally want to believe in non-existence and annihilation after the last synaptic activity from my biological brain, even though I sometimes feel (and fear) that my consciousness might linger for a bit (seconds? minutes? aeons?) against my own will. Because "energy can't be created nor destroyed, so it must be transformed, and it takes time", and both the synaptic activity and biochemical reactions, interactions from which sentience and consciousness emerges, are energy (electrical and chemical, respectively).
Couple this with concepts like Quantum Superposition, Quantum Entanglement, Heisenberg's Uncertainty Principle, among other concepts, and you end up with a fairly creepy uncertainty on whether a dead brain is definitely gone or if there are some "reverberation" from its past synaptic activity across the spacetime continuum, akin to how we can still hear the echoes of Big Bang nowadays or how many "stars" we see on the night sky are just light from past celestial bodies now long gone. I'm not justifying "spirits" or "haunting ghosts", but more of expressing some personal anxiety regarding the residual energy that could be interacting enough to keep some complexity inherent to the very phenomenon we refer to as "consciousness", one that couldn't even "manifest" as a living being, one that couldn't help themselves but watch and "experience" as they're still undergoing the process of dying.
(Edited to fix and clarify some of my previous statements).
@ryujin470 @dsilverz I wonder if my comment was properly federated, as Calckey often faces issues federating content, and fedia.io, the OP's instance, refuses access without logging in.