See your doctor. Having brief hallucinations when falling asleep or waking up (hypnogogic and hypnopompic) does not necessarily indicate a pathological problem. However, these can be part of other treatable conditions such as narcolepsy, schizophrenia, and alcohol or drug abuse. Important to have these issues evaluated, especially if you're concerned enough to ask about treating them. Good luck to you.