3. Let the real numbers $x_{1}, x_{2}$, and $x_{3}$ be the roots of the equation $3 x^{3}-p x^{2}+28 x-p=0$, taking into account their possible multiplicities. Then $3 x^{3}-p x^{2}+28 x-p \equiv 3\left(x-x_{1}\right)\left(x-x_{2}\right)\left(x-x_{3}\right)=$

$$
=3 x^{3}-3 x^{2}\left(x_{1}+x_{2}+x_{3}\right)+3 x\left(x_{1} x_{2}+x_{2} x_{3}+x_{3} x_{1}\right)-3 x_{1} x_{2} x_{3},
$$

from which $x_{1}+x_{2}+x_{3}=p / 3, \quad x_{1} x_{2}+x_{2} x_{3}+x_{3} x_{1}=28 / 3$. Taking this into account, the target expression is transformed as follows:

$$
\begin{aligned}
&\left(x_{1}-2\right)^{2}+\left(x_{2}-2\right)^{2}+\left(x_{3}-2\right)^{2}=x_{1}^{2}+x_{2}^{2}+x_{3}^{2}-4\left(x_{1}+x_{2}+x_{3}\right)+12= \\
&=\left(x_{1}+x_{2}+x_{3}\right)^{2}-2\left(x_{1} x_{2}+x_{2} x_{3}+x_{3} x_{1}\right)-4\left(x_{1}+x_{2}+x_{3}\right)+12= \\
&= \frac{p^{2}}{9}-\frac{56}{3}-\frac{4 p}{3}+12=\frac{p^{2}-12 p-60}{9} .
\end{aligned}
$$

Now let's plot the graph of the equation $3 x^{3}-p x^{2}+28 x-p=0$ on the plane $(x, p)$. Since the parameter enters this equation linearly, it is more convenient to solve it for $p$:

$$
p\left(x^{2}+1\right)=3 x^{3}+28 x=3 x\left(x^{2}+1\right)+25 x \Rightarrow p(x)=3 x+\frac{25 x}{x^{2}+1}
$$

We will find the set of values of the parameter $p$ for which the equation has three real roots. For this, we will investigate $p(x)$:

$$
p^{\prime}(x)=3+\frac{25\left(1-x^{2}\right)}{\left(x^{2}+1\right)^{2}}=\frac{3 x^{4}-19 x^{2}+28}{\left(x^{2}+1\right)^{2}}=\frac{\left(x^{2}-4\right)\left(3 x^{2}-7\right)}{\left(x^{2}+1\right)^{2}}
$$

The odd function $p(x)$ has minima at points $\bar{x}_{2}=-\frac{\sqrt{21}}{3}, \bar{x}_{4}=2$ and maxima at points $\bar{x}_{1}=-2, \bar{x}_{3}=\frac{\sqrt{21}}{3}$,

where

$$
p_{1}=p\left(\bar{x}_{1}\right)=-16, p_{2}=p\left(\bar{x}_{2}\right)=-\frac{7 \sqrt{21}}{2}
$$

$$
p_{3}=p\left(\bar{x}_{3}\right)=\frac{7 \sqrt{21}}{2}, p_{4}=p\left(\bar{x}_{4}\right)=16
$$

For all $c \in\left(p_{2} ; p_{1}\right) \cup\left(p_{4} ; p_{3}\right)$, the line $p=c$ intersects the graph at three points, and the equation $3 x^{3}-p x^{2}+28 x-p=0$ has three distinct roots. For parameter values that coincide with one of $p_{1}, p_{2}, p_{3}$, or $p_{4}$ (on the boundaries of the intervals), there are two points of intersection, which corresponds to the case of multiple roots.

The quadratic trinomial $\frac{p^{2}-12 p-60}{9}$, decreasing for $p6$, takes the smallest possible value on the set $\left[p_{2} ; p_{1}\right] \cup\left[p_{4} ; p_{3}\right]$ when $p=p_{4}=16$.

Thus, under the conditions of the problem,

$$
\min \left(\left(x_{1}-2\right)^{2}+\left(x_{2}-2\right)^{2}+\left(x_{3}-2\right)^{2}\right)=\frac{16^{2}-12 \cdot 16-60}{9}=\frac{4}{9}
$$
The smallest value $\frac{4}{9}$ is achieved when $p=16$.