Just to be different (but essentially exactly the same):
Obviously if $a\equiv \pm b \mod p$ then $a^2 \equiv b^2 \mod p$. ($a = kp \pm b\implies a^2 = (k^2p \pm 2b)*p + b^2$.)
There are $p$ possible integers, $m$ so that $0\le m < p$ and for all integers $a$, $a \equiv m \mod p$ for one of these.
Let $0 \le n < m \le \frac {p-1}2$ and let $d = m-n>0$. Then $m^2 = (n+d)^2 = n^2 + 2nd + d^2$ so $n^2 \equiv m^2 \mod p \implies p|2nd+d^2=d(2n+d)=d(m+d)$.
But $d< p$ and $m+d<p$ so the prime factors of $d(m+d)$ are less than $p$ and $p|d(m+d)$ is impossible.
Now for any two $a,b$ there are for possibilities:
Either $a \equiv m \mod p$ for some $0\le m \le \frac{p-1}2$ or $a \equiv m \mod p$ for some $\frac{p-1}2 < m < p$. If the latter then $-m \equiv p-m \mod p$ and $0 < p-m < \frac {p-1}2$. So $\pm a\equiv m \mod p$ for some $m;0\le m \le \frac{p-1}2$.
Likewise $\pm b \equiv n \mod p$ for some $n;0\le n \le \frac{p-1}2$.
The if $a^2 \equiv b^2 \mod p$ then $m = n$ and thus $\pm a \equiv \pm b \mod p$ and $a \equiv \pm b \mod p$.
.....
Just as the other answers assuming if $p|(a+b)(a-b)$ then $p|a+b$ or $p|a-b$ (Euclid's lemma), this answer assumes if $p|N$ then $N$ has a unique prime factorization and $p$ is one of the factors, and further if $N$ has factors, that $p$ is a factor of one of the factors (Unique prime factorization theorem).
These are essentially the same assumption.