I am not clear on what you are doing. Will you have a couple of days to drive from Nice to Montpellier and want an over night stop? Or are you just wanting suggestions for a place for a couple of nights - could be at either end.
You could drive from Nice to Montpellier in a day along the autoroute, and you could visit Cannes from Nice if you are staying there. You will not ' drive through ' Marseille unless you specifically choose to do so. That is the purpose of autoroutes - to avoid cities. Personally, we prefer smaller places rather than large cities with their inherent problems of time spent getting in and out, traffic, parking. Best really depends on what you want to do. Do you want a city experience? Are these places you especially want to visit ? If not I would be looking at a smaller place.
Perhaps if you tell us what your plans are before and after this drive, we could give better advice. Will you have time in Nice and Montpellier outside this couple of days?
We will arrive in Cannes and hire a car to drive to Montepellier, but we have 3 nights to stay in between somewhere. I just wanted to see whether it was worth staying in Marseille as it looks nicer than Montepellier. Its the last leg of our 3 week trip so want to enjoy the South of France as much as possible.
It is really personal preference I suppose , but I would not choose to stay in either unless you really want to see them . We much prefer smaller places. Have you considered a couple of nights in the Luberon exploring the lovely villages ? For a larger place but not a huge city like Marseille, you could look at Aix en Provence. Aigues Mortes is an interesting walled town on the coast which could be nice for an overnight before continuing on to Montpellier to drop your car.
As I said, it really is what you prefer. We have not been to either city but have spent time in Western Provence and in the Herault north of Montpellier and the villages are lovely. But if you prefer cities either would have enough to keep you busy for a couple of days.Edited: 11 May 2018, 16:22
I will add that if it is just these cities you want to visit, you would be better just taking the train . A car is often an expensive nuisance in a large city. There is no point in staying in Marseille for two nights and having a car sitting there not being used.
If you just want a nice place on the coast , what about Cassis?Edited: 11 May 2018, 17:13
Too late to edit: I meant to say that with a car I WOULD NOT stay in a big city.