Hint $\ $ Below I give an analogous proof for divisor $5$ (vs. $3),$ exploiting reflection symmetry.
Lemma $\ $ Every integer $\rm\:n\:$ has form $\rm\: n = 5\,k \pm r,\:$ for $\rm\:r\in\{0,1,2\},\ k\in\Bbb Z.$
Proof $\ $ By the Division algorithm
$$\rm\begin{eqnarray} n &=&\:\rm 5\,q + \color{#c00}r\ \ \ for\ \ some\ \ q,r\in\Bbb Z,\:\ r\in [0,4] \\
&=&\:\rm 5\,(q\!+\!1)-(\color{#0a0}{5\!-\!r})
\end{eqnarray}$$
Since $\rm\:\color{#0a0}{5\!-\!r}+\color{#c00}r = 5,\,$ one summand is $\le 2,\,$ so lies in $\{0,1,2\},\,$ yielding the result.
Theorem $\ $ The square of an integer $\rm\,n\,$ has form $\rm\, n^2 = \,5\,k + r\,$ for $\rm\:r\in \{0,1,4\}.$
Proof $\ $ By Lemma $\rm\ n^2 = (5k\pm r)^2 = 5\,(5k^2\!\pm 2kr)+r^2\,$ for $\rm\:r\in \{0,1,2\},\,$ so $\rm\: r^2\in\{0,1,4\}.$
Remark $\ $ Your divisor of $\,3\,$ is analogous, with $\rm\:r\in \{0,1\}\,$ so $\rm\:r^2\in \{0,1\}.\,$ The same method generalizes for any divisor $\rm\:m,\,$ yielding that $\rm\:n^2 = m\,k + r^2,\,$ for $\rm\:r\in\{0,1,\ldots,\lfloor m/2\rfloor\}.$
The reason we need only square half the remainders is because we have exploited reflection symmetry (negation) to note that remainders $\rm > n$ can be transformed to negatives of remainders $\rm < n,\,$ e.g. $\rm\: 13 = 5\cdot 2 +\color{#0A0} 3 = 5\cdot 3 \color{#C00}{- 2},\,$ i.e. remainder $\rm\:\color{#0A0}3\leadsto\,\color{#C00}{-2},\,$ i.e. $\rm\:3 \equiv -2\pmod 5.\:$ This amounts to using a system of balanced (or signed) remainders $\rm\, 0,\pm1,\pm2,\ldots,\pm n\ $ vs. $\rm\ 0,1,2,\ldots,2n[-1].\:$ Often this optimization halves work for problems independent of the sign of the remainder.
All of this is much clearer when expressed in terms of congruences (modular arithmetic), e.g. the key inference above $\rm\:n\equiv r\:\Rightarrow\:n^2\equiv r^2\pmod m\:$ is a special case of the ubiquitous
Congruence Product Rule $\rm\ \ A\equiv a,\ B\equiv b\ \Rightarrow\ AB\equiv ab\ \ (mod\ m)$
Proof $\rm\:\ \ m\: |\: A\!-\!a,\ B\!-\!b\:\ \Rightarrow\:\ m\ |\ (A\!-\!a)\ B + a\ (B\!-\!b)\ =\ AB - ab $
For an introduction to congruences see any decent textbook on elementary number theory.