Let $a=\text{ind}_g(h)$ and $b=\text{ind}_h(g)$. Then $h\equiv g^a\pmod{m}$ and $g\equiv h^b\pmod{m}$. So $h\equiv (h^b)^a\equiv h^{ab}\pmod{m}$. It follows that $ab\equiv 1\pmod{\varphi(m)}$.
_Remarks_ : $1.$ The solution proposed in the OP does not work. It is true that $g^{\varphi(m)}\equiv h^{\varphi(m)}\pmod{m}$, they are both congruent to $1$. But from this one cannot conclude that $g=h$.
$2.$ Note that the relationship we have established is analogous to the relationship between $\log_x y$ and $\log_y x$.