If $A - B$ is divisible by $10^n$, and $A$ and $B$ share a common last digit of $5$, then $A^2 - B^2 = (A + B)(A - B)$ is divisible by $10^{n + 1}$ (as $A + B$ is divisible by $10$).

In other words, if $A$ and $B$ have the same last $n$ many digits, and share a common last digit of 5, then $A^2$ and $B^2$ have the same last $n + 1$ many digits.

From this it inductively follows that in the sequence of values $5, 5^2 = 25, 25^2 = 625, \ldots$, where each value is the square of the previous one, the last $n$ digits stabilize from the $n$th element onwards (with $5$ as the $1$st element), yielding a 10-adic number which is its own square.

As noted by Achim Krause, you can also understand what is going on as that this sequence is converging to 1 in the 2-adics and 0 in the 5-adics. (The convergence in the 5-adics will be much faster, in that of course each squaring doubles the number of 0s at the end of the base 5 representation, but the convergence in the 2-adics will only gain one newly stabilized digit at a time, so that the convergence in the 10-adics is also by one digit at a time.)