Example 6 Given the function $f(x)=x^{2}-a x+\frac{a}{2}(a>0), x \in[0,1]$, find the minimum value $g(a)$ of $f(x)$, and then find the maximum value of $g(a)$.
Solution: $f(x)=\left(x-\frac{a}{2}\right)^{2}+\frac{a}{2}-\frac{a^{2}}{4}$.
When $0 \leqslant \frac{a}{2} \leqslant 1$ i.e., $0<a<2$, $g(a)=f\left(\frac{a}{2}\right)=\frac{a}{2}-\frac{a^{2}}{4}$.
When $\frac{a}{2}>1$ i.e., $a>2$, $g(a)=f(1)=1-\frac{a}{2}$. Hence, $g(a)=\left\{\begin{array}{ll}\frac{a}{2}-\frac{a^{2}}{4} & 0<a<2 \\ 1-\frac{a}{2} & a>2\end{array}\right.$, it is easy to see that $g(a)_{\max }=\frac{1}{4}$.