5. Given the function
$$
y=x^{2}-a x+a-2(a \in \mathbf{R}),
$$

and the graph of the function intersects the $x$-axis at two different points. Then the minimum distance between these two points is ( ).
(A) 2
(B) 4
(C) 8
(D) uncertain
5. A.

Given the function $y=x^{2}-a x+a-2$ intersects the $x$-axis at two distinct points, let's assume the two roots of $x^{2}-a x+a-2=0$ are $x_{1}$ and $x_{2}$. Then,
$$
x_{1}+x_{2}=a, x_{1} x_{2}=a-2 .
$$

Therefore, the distance between the two intersection points is
$$
\begin{aligned}
d & =\left|x_{1}-x_{2}\right|=\sqrt{\left(x_{1}-x_{2}\right)^{2}} \\
& =\sqrt{\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}} \\
& =\sqrt{a^{2}-4(a-2)} \\
& =\sqrt{(a-2)^{2}+4} .
\end{aligned}
$$

Clearly, when $a=2$, $d=\left|x_{1}-x_{2}\right|$ reaches its minimum value, which is 2.