Denote by $f(n)$ the maximal size $|A|$ of a subset $A\subset \{0,1,\dots,n-1\}^2$ with integer distances. We have $f(2k)\leqslant 2f(k)$$f(n)\leqslant 2f(\lceil n/2\rceil )$, $f(2k+1)\leqslant 2f(k+1)$$f(n)\leqslant 3f(\lceil n/3\rceil)$.
This follows from the following observation. $A$ can not contain two points $(a,b)$ and $(c,d)$ such that both $a-c$ and $b-d$ are odd, or both are not divisible by 3. Therefore either all abscissas of points of $A$ have the same parity (respectively, remainder modulo 3), or all ordinates. ThereforeHence $A$ is covered by two translates of $(2\mathbb{Z})\times (2\mathbb{Z})$ which leadand by three translates of $(3\mathbb{Z})\times (3\mathbb{Z})$. This leads to above estimates.
This gives $f(n)\leqslant n$ for all $n$ of the form, say, $2^k$, or$n=2^k3^m$ $3\cdot 2^k$(or $n=5\cdot 2^k 3^m$ as $f(5)=5$.) Since the ratio of two consecutive numbers of this form tends to 1, and some close but still worse estimates for allwe get $n$$f(n)=n+o(n)$ for sure.