18. (12 points) In a box, there are three cards labeled $1, 2, 3$. Now, from this box, two cards are drawn with replacement, and their labels are $x$ and $y$, respectively. Let $\xi=|x-2|+|y-x|$.
(1) Find the maximum value of the random variable $\xi$, and the probability of the event “$\xi$ takes the maximum value”;
(2) Find the distribution of the random variable $\xi$ and its expected value.
18. From the conditions, the possible values of $x$ and $y$ are $1, 2, 3$.

Then, $|x-2| \leqslant 1, |y-x| \leqslant 2$.
Thus, $\xi \leqslant 3$, where $\xi=3$ when $x=1, y=3$ or $x=3, y=1$.
Therefore, the maximum value of the random variable $\xi$ is 3.
Since there are $3 \times 9$ possible scenarios when drawing two cards with replacement, $P(\xi=3)=\frac{2}{9}$.
Hence, the required probability is $\frac{2}{9}$.
(2) The possible values of the random variable $\xi$ are $0, 1, 2, 3$.
When $\xi=0$, there is only one scenario: $x=2, y=2$, so $P(\xi=0)=\frac{1}{9}$.
When $\xi=1$, there are four scenarios: $x=1, y=1$ or $x=2, y=1$ or $x=2, y=3$ or $x=3, y=3$, so
$$
P(\xi=1)=\frac{4}{9}.
$$

When $\xi=2$, there are two scenarios: $x=1, y=2$ or $x=3, y=2$, so
$$
P(\xi=2)=\frac{2}{9}.
$$

Thus, the distribution of the random variable $\xi$ is as shown in Table 1.
Table 1
\begin{tabular}{|c|c|c|c|c|}
\hline$\xi$ & 0 & 1 & 2 & 3 \\
\hline$P$ & $\frac{1}{9}$ & $\frac{4}{9}$ & $\frac{2}{9}$ & $\frac{2}{9}$ \\
\hline
\end{tabular}

Therefore, $E \xi=0 \times \frac{1}{9}+1 \times \frac{4}{9}+2 \times \frac{2}{9}+3 \times \frac{2}{9}=\frac{14}{9}$.