  Given $\mathbb{F}_q$ the finite field with $q$ elements and an integer $n\geq
2$, a flag is a sequence of nested subspaces of $\mathbb{F}_q^n$ and a flag
code is a nonempty set of flags. In this context, the distance between flags is
the sum of the corresponding subspace distances. Hence, a given flag distance
value might be obtained by many different combinations. To capture such a
variability, in the paper at hand, we introduce the notion of distance vector
as an algebraic object intrinsically associated to a flag code that encloses
much more information than the distance parameter itself. Our study of the flag
distance by using this new tool allows us to provide a fine description of the
structure of flag codes as well as to derive bounds for their maximum possible
size once the minimum distance and dimensions are fixed.
