No, there are no restrictions. Here is a construction of such a threefold $X$. [I assume that the $Y_i$ are connected, and I look for a connected $X$.]
For $i\in\{1,2\}$, let $C_i$ be the cone over $Y_i$ in some projective embedding of $Y_i$. Let $f_i:C'_i\to C_i$ be the blow-up of the vertex of $C_i$, with exceptional divisor isomorphic to $Y_i$. Choosing a projective embedding of $C_i$, and then a generic projection to $\mathbb{P}^3$, we obtain a finite morphism $g_i:C_i\to\mathbb{P}^3$.
Composing $g_1$ with a generic element of $\textrm{PGL}_4(\mathbb{C})$, we may assume that the image by $g_i$ of the vertex of $C_i$ is included in the locus above which $g_{3-i}$ is étale (for $i\in\{1,2\}$).
Consider the fiber product $(C'_1)\times_{\mathbb{P}^3}(C'_2)$ of the morphisms $g_i\circ f_i$. It contains $\textrm{deg}(g_1)$ copies of $Y_2$ and $\textrm{deg}(g_2)$ copies of $Y_1$, and it is smooth along these subvarieties. Using that $C_1'$ and $C'_2$ are irreducible, it is easily verified that one can choose one copy of $Y_1$ and one copy of $Y_2$ belonging to the same connected component $Z$ of the smooth locus of $(C'_1)\times_{\mathbb{P}^3}(C'_2)$. We let $X$ be a smooth projective compactification of $Z$.