Example 8 Let $a, b, c \in \mathbf{R}_{+}$, and $abc + a + c = b$. Find the maximum value of
$$
p=\frac{2}{a^{2}+1}-\frac{2}{b^{2}+1}+\frac{3}{c^{2}+1}
$$
Let $a=\tan \alpha, b=\tan \beta, c=\tan \gamma$ $\left(\alpha, \beta, \gamma \in\left(0, \frac{\pi}{2}\right)\right)$.
From $a b c+a+c=b$, we get $b=\frac{a+c}{1-a c}$, which means
$$
\begin{array}{l}
\tan \beta=\tan (\alpha+\gamma) \Rightarrow \beta=\alpha+\gamma . \\
\text { Therefore, } p=2 \cos ^{2} \alpha-2 \cos ^{2}(\alpha+\gamma)+3 \cos ^{2} \gamma \\
=\cos 2 \alpha+1-\cos (2 \alpha+2 \gamma)-1+3 \cos ^{2} \gamma \\
=2 \sin \gamma \cdot \sin (2 \alpha+\gamma)+3 \cos ^{2} \gamma \\
\leqslant 2 \sin \gamma+3 \cos ^{2} \gamma \\
=3-3 \sin ^{2} \gamma+2 \sin \gamma \\
=-3\left(\sin \gamma-\frac{1}{3}\right)^{2}+\frac{10}{3} \leqslant \frac{10}{3} .
\end{array}
$$

Thus, when $2 \alpha+\gamma=\frac{\pi}{2}, \sin \gamma=\frac{1}{3}$, i.e., $a=$ $\frac{\sqrt{2}}{2}, b=\sqrt{2}, c=\frac{\sqrt{2}}{4}$, $p$ attains its maximum value $\frac{10}{3}$.