Every person has a perceptual ceiling. If they are stimulated beyond this, their rational mind will disengage to reduce anxiety.
An anxiety spiral (like a panic attack) is the most common cause of this phenomenon. But it is also possible to be highly stimulated by the environment, e.g. being in a warzone or experiencing extraordinary pain.
Mental engagement, the rate of energy expended in the conscious mind, is a curiously simple phenomenon. Up to a point, Engagement = Interest + Challenge. Getting students to engage with subject material is the holy grail of education. But there is a point above which the conscious mind gives up in order to conserve energy.
Because the rational mind acts as a very important filter on our granular perceptions, this shutdown can produce all sorts of indefensible, uninterrupted pattern-matching. The mind is running on pure heuristics and instinct and the patterns it infers will often be unrealistic and will attempt to explain the person’s emotional state with whatever cues are available in the environment. That is, a person who is afraid will invent an external reason why they must be afraid. This may be in the form of a delusion (insofar as the mind can be mustered to invent one) or a sensory hallucination.
For example, imagine a person is having a panic attack while the wind is blowing very hard. A rational person will interpret this as “I am very afraid for some reason, plus there is a loud noise”. But a person who’s rational mind is suppressed will interpret this as “I am afraid and it must be due to this loud noise, therefore the loud noise must be something fearful”, and so they will hear the wind as screaming voices from hell or something else scary.
For more illustration of this, read up on hypnopompia.