Years ago. my mother was in the ICU for 2 weeks, near death. At some point, when she was able to talk, she told me about watching the gray and white kitten playing above her on the ceiling and how it kept her entertained. (She was looking at the acoustic tiles.)

A few months later, she did explain that on some level, she had known that the kitten wasn't really there, but it had been such a comfort when she was (rarely) conscious that she just went with the flow.
Then she went to cardiac ICU for at least a week and seemed okay there. Weak and slept a lot, but okay. From there, she went to a regular room for another week and that's when we noticed the weirdness. It would take too long to explain, but she'd have decent stretches of bieng herself and then just lose her mental faculties. Suddenly. She'd be unable to use the right words, start frantically searching for things that she could not explain, get lost in a fog.......so many odd things. We thought it was a stroke, but they said it wasn't. The hospital discharged her since there was nothing to treat and we had to take her home. She lived alone.
It was summer and I was a teacher, so I stayed with her. She could not be left alone for 5 minutes because you never knew when she might "lose her mind." One night, my sister stayed with her and our fragile mother spent the entire night moving furniture and TVs and could not be stopped. I was at the point where I thought I'd have to quit work and move her in with us, because I refused to put her in a nursing home and she could not be left alone. (She was in her mid-60s.) For 18 days after leaving the hospital, she was like this.
We kept logs and noticed that when she got a decent amount of sleep, the craziness would stop for a while. Sleep seemed to change things. We took her to a neurologist, who couldn't really find anything and of course, she was fine and dandy and sharp as a tack during the exam. I think the dr. thought we (the DDs) were the nutty ones. Thank God she didn't have money or he'd have thought we were after it.
He did mention she might have a sleep disturbance. I mentioned how long she'd been hospitalized and he said that if her sleep patterns had been seriously disturbed during that time, it would take a while for her to get back to normal. And after the 18 days of craziness after checking out of the hospital, she slept one day for 14 hours or so and was never "off" again. All was well.
When she was back to her normal self, she said she usually realized when she was acting crazy weird, just couldn't communicate well enough to use the right words or stop her behavior. And she said she'd never gotten any decent sleep in the hospital because every couple of hours, at a minimum, they were taking blood, running tests, giving her meds, etc. She was sleep deprived, much like a POW. Her mind cracked.
I hope this helps. I truly thought she would need 24 hour a day care for the rest of her life, that's how bad she was. And it did last after she left the hospital, until she re-established her sleep pattern. But she was fine for 15 years after that, until she passed away. Just know that it happens and it can certainly go away.
Good luck.