Depersonalization is the experience that you are detached and things are unreal, such as perceptual changes, changes in the sense of time, and emotional/physical numbing. Depersonalization is a symptom of panic attacks, especially with severe panic attacks. So depersonalization and anxiety are related, as depersonalization is a symptom of panic attacks.
Depersonalization is also a symptom of depersonalization/derealization disorder, where you are detached and things feel unreal. However, your reality testing is intact, as outside of the episodes you are able to tell what is real and what is imagination.