This will answer your questions in the comments, and a question that combines them into something else.
First, the most trivial one: to minimize $(u_4 + \frac{u_1 + u_2+u_3}{\sqrt{2}})^2$, given that you already have solutions for fewer variables, the solution is to set $u_3=0$ and use your previous answer.
Second, you cannot make $(u_3 + \frac{u_1 + u_2}{\sqrt{3}})^2$ close to zero. This is covered in a more general case, so let's get to that.
Suppose we have $x_1^2 + \cdots + x_k^2 = y^2$, with $x_1 \leq x_2 \leq \cdots \leq x_k$. Then the rational numbers $a_i=x_i/x_1$ are increasing, and $a_1=1$. We have $y^2 = x^2\left(\sum_{i=1}^ka_i^2\right)$, and we want $y$ to be very close to $x\left(\sum_{i=1}^ka_i\right)/\sqrt{n}$. Simplifying, this means we want $n\left(\sum_{i=1}^ka_i^2\right)$ to be close to $\left(\sum_{i=1}^ka_i\right)^2$. By Chebyshev's sum inequality, we have
$$
\left(\sum_{i=1}^ka_i\right)^2 \leq k\left(\sum_{i=1}^ka_i^2\right) < n\left(\sum_{i=1}^ka_i^2\right)
$$
when $k < n$. Since each $a_i$ is at least $1$, the final inequality is separated by at least $k(n-k)$, so they won't be close.
Now let's suppose we want to minimize the expression for $\left(y - \frac{x_1+\cdots +x_n}{\sqrt{n}}\right)^2$ for some non-square $n$. Chebyshev's inequality is equal when all terms are equal, so we will try to make all of our terms nearly equal, setting all but one of them to $x$, and the last to $x+1$. Hence, we are trying to solve $nx^2+2x+1=y^2$, or after completing the square, $(nx+1)^2 + (n-1) = y^2$, or equivalently, $X^2 - nY^2 = 1-n$. This is a generalized Pell equation, and has one obvious solution, hence has infinitely many.
We could has also asked for one smaller value, and $n-1$ larger ones, so that $y^2 = (x-1)^2 + x^2 + \cdots x^2$ and we would have the same final equation to solve. Solutions for $n=3$ can be found in the OEIS, A122770 and A081065. For $n=5$, the $y$ values are odd terms in the Fibonacci sequence, and the $x$ values are listed at A081018, and A081016. The equation with two smaller and three larger values, or vice versa, has no solutions (by congruence mod $4$). For $n=6$, you can find values for one larger at A220755, and you can derive values for one smaller from the sequence A080806. The other cases have no solutions, considering two larger or smaller mod $8$, and three of each mod $9$. I didn't look up any more values, but you can certainly derive them from the Pell equation. Here's a nice one for those who like to jump to the conclusion:
$$
11481^2 + 11481^2 + 11481^2 + 11481^2 + 11481^2 + 11482^2 = 790903129 = 28123^2
$$
and
$$
(11481 + 11481 + 11481 + 11481 + 11481 + 11482)/28123 = 2.449489741 \ldots \\ \sqrt{6} = 2.4494897427\ldots
$$