Hello and hope you are doing well.
The symptoms you are experiencing could be due to an entity called Hypnagogic hallucinations, which are hallucinations which occur between sleep and awakening.
This is the symptom of a sleep disorder called Narcolepsy. This sleep disorder is characterized by excessive day time sleepiness, sleep paralysis, cataplexy where the person has episodes of loss of muscle function while awake, hypnogogic hallucinations and automatic behavior. You will need to consult your primary care physician, who may schedule you for a polysomnogram (sleep test) to rule out sleep disorders and initiate appropriate therapy.
Hope this helped and do keep us posted.