I had this kind of brainfog intermittently for years, but it's quite rare now.
As it relates directly to DP/DR, I think when you are displaced from or outside yourself, feeling disconnected from the world, only a small fragment of yourself is actually engaged with reality. The conscious part of you is somehow compartmentalized from the rest of you as a passive observer, so nothing (memory retrieval, evocation of feelings, executive function, visualization, etc.) works very efficiently.
When you have a strong sense of identity, and you are relatively unconflicted in purpose and values, and actively engaged in fulfilling them, then all your faculties are tightly integrated and function together harmoniously.
On top of this, it's hard to think clearly when you're anxious, and the anxiety (particularly panic attacks) will burn away all your mental energy faster than anything and fry your nerves, so your brain is constantly exhausted and running in a low energy state. Unresolved feelings that don't rise to the level of awareness could also be wreaking havoc.
Visualization doesn't work well when you're not in a relaxed state, and not at all when in a state of hypervigilance for some intangible threat. I think you would find visualization effortless if you could get into an alpha state.
The fear that there is something wrong can perpetuate this, so it's important to realize that there's almost certainly nothing wrong with you.
DP/DR can also be pretty traumatizing, and may trigger depression, both of which could exacerbate these symptoms even after DP/DR passes. Other unrelated causes are of course possible, such as diet, or other health issues.
Learn to notice when this brainfog lifts, even just a little, and do more of whatever you were doing. Exercise all dimensions of your physical, emotional, social, creative, spiritual and intellectual self at every opportunity! You'll soon find your way out of the fog.
When the brainfog passes, your faculties might not be as sharp they were, having rusted from disuse. When it starts to improve, keep going. To stay sharp and to feel fully alive we need to stay active and connected.
For relaxation and visualization, here's some Bob Ross:
Does anyone has this also? I am at the point of losing everything.
Not visualizing anything
No words in social occasions.
Disconnected from everything