5. Given that point $P$ moves on the circle $C: x^{2}+(y+2)^{2}=\frac{1}{4}$, point $Q$ moves on the curve $y=a x^{2}(a>0,-1 \leqslant x \leqslant 2)$, and the maximum value of $|P Q|$ is $\frac{9}{2}$, then $a=$ $\qquad$ .
$$
\begin{array}{l}
|Q C|^{2}=x^{2}+\left(a x^{2}+2\right)^{2}=a^{2} x^{4}+(4 a+1) x^{2}+4 \leqslant 16 a^{2}+16 a+8=16 \\
\Rightarrow 2 a^{2}+2 a-1=0 \Rightarrow a=\frac{\sqrt{3}-1}{2}
\end{array}
$$

Translation:

$$
\begin{array}{l}
|Q C|^{2}=x^{2}+\left(a x^{2}+2\right)^{2}=a^{2} x^{4}+(4 a+1) x^{2}+4 \leqslant 16 a^{2}+16 a+8=16 \\
\Rightarrow 2 a^{2}+2 a-1=0 \Rightarrow a=\frac{\sqrt{3}-1}{2}
\end{array}
$$