Assume first that the teams are labelled, with the two teams of three having labels A and B, and the three teams of four having labels C, D, and E.
There are $\binom{18}{3}$ ways to choose the people who will be on Team A. For each of these ways, there are $\binom{15}{3}$ ways to choose Team B. For every way to choose Teams A and B, there are $\binom{12}{4}$ ways to choose Team C, and then $\binom{8}{4}$ ways to choose Team D, and finally, if we like, $\binom{4}{4}$ ways to choose Team E.
However, when we remove the labels, the number of choices for the $2$ three-person teams gets divided by $2!$, and the number of choices for the $3$ four-person teams gets divided by $3!$, for a total of
$$\frac{\binom{18}{3}\binom{15}{3}\binom{12}{4}\binom{8}{4}\binom{4}{4}}{2!3!}.$$
For the Mia and Max problem, we could count. But we prefer to work directly with probabilities.
Imagine that the people first get divided into $2$ groups, of $6$ and $12$, to make up the two kinds of team.
The probability that Mia is selected for the group of $6$ is $\frac{6}{18}$. Given that this has happened, the probability Max is chosen for the same team is $\frac{2}{17}$. Thus the probability Mia and Max are in the same team of three is
$$\frac{6}{18}\cdot\frac{2}{17}.$$
Similarly, the probability that Mia and Max are in the same group of $4$ is
$$\frac{12}{18}\cdot\frac{3}{17}.$$
Add.
Remark: Doing problem (b) by counting and dividing is not difficult, just a little more messy-looking. Note that the probabilities are the same for the labelled teams case as for the unlabelled case. It is easier not to make a mistake by counting the number of ways that Mia and Max can be on the same labelled team, and dividing by the number of labelled teams.