Example 6 Let $f(n)=2 n+1(n \in \mathbf{N}), U=\mathbf{N}, P=\{1,2,3,4,5\}, Q=\{3,4$, $5,6,7\}$, and let $A=\{n \mid f(n) \in P, n \in \mathbf{N}\}, B=\{n \mid f(n) \in Q, n \in \mathbf{N}\}$, then $(A \cap$ $\left.\complement_{U} B\right) \cup\left(B \cap \complement_{U} A\right)=$ $\qquad$ .
Solve: According to the problem, from $\left\{\begin{array}{l}1 \leqslant 2 n+1 \leqslant 5, \\ n \in \mathbf{N},\end{array}\right.$ we get $n=0,1,2$, so $A=\{0,1,2\}$. Similarly, $B=\{1,2,3\}$, so $\left(A \cap \complement_{U} B\right) \cup\left(B \cap \complement_{U} A\right)=\{0,3\}$.