Yes, this train is separated in Mendrisio. I take this train from time to time to position from Lugano to Chiasso. In Mendrisio, there is an announcement that the train will be separated now.
Just get on the right part in Lugano, watch out for the destination indication on the coach and you are all set.
Boarding the right coach will mean you do not have to change trains in Mendrisio.