5. Let real numbers $a, b$ satisfy $0 \leqslant a, b \leqslant 8$, and $b^{2}=$ $16+a^{2}$. Then the sum of the maximum and minimum values of $b-a$ is $\qquad$
5. $12-4 \sqrt{3}$.

From the given, we know $b^{2}=16+a^{2}$.
Then $b-a=\frac{b^{2}-a^{2}}{b+a}=\frac{16}{\sqrt{a^{2}+16}+a}$.
Let $f(a)=\frac{16}{\sqrt{a^{2}+16}+a}$. Thus, the function $f(a)$ is monotonically decreasing.
$$
\begin{array}{l}
\text { Given } 0 \leqslant a, b \leqslant 8 \Rightarrow 16+a^{2} \leqslant 64 \\
\Rightarrow 0 \leqslant a \leqslant 4 \sqrt{3} .
\end{array}
$$

Then the minimum value of $b-a$ is $f(4 \sqrt{3})=8-4 \sqrt{3}$, and the maximum value of $b-a$ is $f(0)=4$.

Therefore, the sum of the maximum and minimum values of $b-a$ is $12-4 \sqrt{3}$.