One time I thought I was gonna have a seizure, I layed down and curled up saying fml, and my cat came running from the other room and layed on my chest. No seizure. love you buddy, my familiar.
Not all cats but I've certainly had some cats that were way more in tune with things.
Our cat Midnight, our best mouser, protected the pet hamster from the other cats when it got out of its cage.
She also never laid on me. But one night, laying on my sister's bed, she laid on my back and purred like crazy. I was in a very dark headspace that night. Suicidal ideation and what not (something I struggled a lot with in my life due to childhood trauma that has mostly resolved with the help of EMDR, Buddhism, and plant medines).
I did some time for growing psilocybin. Midnight came to me in my dreams. My spirit guide, again, in that dark place.
She lived to be eighteen. Great friend. Much more than a pet.
edit: She also snatched a piece of roast right off my plate lol. She was sitting on the arm of the couch and waited until I turned my head, distracted, talking to my gf.
Fun fact: the most likely actual reason your cat or dog seems to suddenly go alert and start staring, barking/mewling, and other weird startle behaviors is actually because their hearing is many times more sensitive than yours. So yes, they can detect things you can't, but instead of ghosts it's probably a person or an animal outside. Their hearing also don't "turn off" when they sleep like ours do, they are still constantly processing sound information to almost the same extent as when they're awake.