Example 2 Given that $A$ and $B$ are two subsets of the set $\{1,2,3, \cdots, 100\}$, satisfying $|A|=|B|$, and $A \cap$ $B=\varnothing$. If $x \in A$ always implies $2 x+2 \in B$, then the maximum number of elements in the set $A \cup B$ is $\qquad$.
Solution: When $x \in A$, $2 x+2 \in B \subseteq\{1,2, \cdots, 100\}$. Therefore, $2 x+2 \leqslant 100, x \in 49$, hence $A \subseteq$ $\{1,2,3, \cdots, 49\}$. Divide $\{1,2,3, \cdots, 49\}$ into the following 33 subsets: $\{1,4\},\{3,8\},\{5,12\}, \cdots,\{23, 48\}$, a total of 12; $\{2,6\},\{10,22\},\{14,30\},\{18,38\}$, a total of 4; $\{25,27,29, \cdots, 49\}$, a total of 13; $\{26\}$, $\{34\},\{42\},\{46\}$, a total of 4. If $|A| \geqslant 34$, then by the pigeonhole principle, there must be 2 elements in $A$ belonging to the same subset among the above 33 subsets, i.e., there exists $x \in A$ and $2 x+2 \in A$, so $A$ does not meet the requirements of the problem, thus $|A| \leqslant 33$, and $|A \cup B|=|A|+|B|=2|A| \leqslant 66$. On the other hand, if we take $A=\{1,3,5, \cdots, 23,25,27, \cdots, 49,2,10,14,18,26,34,42,46\}$, and $B=\{2 x+2 \mid x \in A\}$, then $A$ and $B$ satisfy the problem's requirements and $|A \cup B|$ $=|A|+|B|=2|A|=66$. Therefore, $|A \cup B|$ is at most 66.