If it is close to falling asleep, there is a thing called hypnagogic hallucinations. They are not necessarily complex hallucinations, can be flashes of colors, lights, sounds, weird tactile sensations... You can look it up online, those are completely normal. They can intensify though with chronic lack of sleep and also unusually severe stress. I get them often and they indeed tend to be more intense when I am especially anxious and/or exhausted but can't rest well.
Please try not to think there is something wrong with you all the time if possible! You can keep discovering stuff endlessly.