Liquids having different densities form separate layers, since they do not mix well with each other. Such liquids are known as immiscible liquids.
The separation of immiscible liquids is carried out using a separating funnel. In the separating funnel, the liquid having more density will be at bottom layer while the liquid having less density will be at top layer.
In the mixture given to us, we have components X and Y. Let's say X is more denser than Y, then X will form a bottom layer and Y will be at top. Therefore, X will be collected in a separate container, hereby separating the components of the mixture.