Here is a generalization of a special case, namely the case of self-adjoint idempotents.
Suppose that $p$ and $q$ are self-adjoint idempotents (projections) in a C*-algebra $A$. If $\|p-q\|<1$, then there is a continuous path of projections in $A$ from $p$ to $q$. If $A$ is unital, this implies that $p$ and $q$ are unitarily equivalent. In general, it implies that there is a partial isometry $v\in A$ such that $v^*v=p$ and $vv^*=q$. This is shown in Chapter 2 of Rørdam et al.'s An introduction to K-Theory for C*-algebras
In the case where $A=M_n(\mathbb C)$, this tells us that $\|p-q\|<1$ implies that $\mathrm{rank}(p)=\mathrm{Tr}(v^*v)=\mathrm{Tr}(vv^*)=\mathrm{rank}(q)$, a special case of Robert Israel's answer.
On a related note, it isn't too hard to show that if $p$ and $q$ are arbitrary projections in a C*-algebra, then $\|p-q\|\leq 1$. More generally, if $a\geq 0 $ and $b\geq 0$ in a C*-algebra, then $\|a-b\|\leq \max\{\|a\|,\|b\|\}$. In particular, if $p$ and $q$ are self-adjoint idempotent matrices of different ranks, then $\|p-q\|=1$.