3. Given that the maximum value of $x$ satisfying the inequality
$$
\left|x^{2}-4 x+p\right|+|x-3| \leqslant 5
$$

is 3. Then the solution set of this inequality is
$\qquad$
3. $\{x \mid 2 \leqslant x \leqslant 3\}$.

According to the problem, 3 should be a root of the equation $\left|x^{2}-4 x+p\right|+|x-3|=$ 5, so we can get $p=-2$ or $p=8$.
If $p=-2$, the original inequality becomes
$$
\left|x^{2}-4 x-2\right|+|x-3| \leqslant 5 \text {. }
$$

Obviously, $x=4$ is a solution to this inequality, which does not meet the problem's requirement.
Therefore, $p=8$.
At this point, the inequality is
$$
x^{2}-4 x+8+|x-3| \leqslant 5 \text {. }
$$

Solving it yields $2 \leqslant x \leqslant 3$.