France doesn't have much in the way of long-distance buses. Long-distance transportation is based on the train network, with regional and local buses to connect towns and villages that lack a railway line. There are low-cost long-distance (slower, but cheaper than the train), but almost all of them are for international destinations, because until recently, the authority that managed the train network had a monopoly on nation-wide travel. For a trip like Carcassonne to Nice, the train is the only realistic public transport option. Between Barcelona and Carcassonne, both train and bus are possible, but buses are a lot less frequent than the train and not significantly cheaper.
You can look up connection options on Rome2Rio: Barcelona to Carcassonne, Carcassonne to Nice. I think they cover all realistic options. A better interface to look up the train schedules is the German railways website. To book tickets, go to the French railways website. You need to book tickets in advance for the high-speed trains (TGV), and you usually get a better price if you book early. You cannot book a seat on regional (TER) trains; for trains listed as Intercités, it depends, and some do have cheaper non-refundable advance fares.
From Barcelona to Carcassonne, take one of the high-speed trains to Lyon and change at Narbonne; there's also one daily direct train to Toulouse that stops at Carcassonne. The trip takes between 2½ and 4 hours depending on how long you have to wait in Narbonne. For comparison, the direct buses take about 4 hours.
From Carcassonne to Montpellier, Marseille and Nice, there are reasonably frequent trains, possibly with a change in Narbonne and Avignon. You can take faster high-speed trains, or stick to slower and usually cheaper regional trains. The speed difference isn't that big, because there is no high-speed line: the regional trains are moslty slower because they make more stops.
Apart from the side trip from Narbonne to Carcassonne, the train line more or less follows the coast, as much as the motorway does. If you really want to keep the sea in sight as much as possible, you'd have to drive along smaller roads.
If you're going to rent a car, I suggest renting in Carcassonne. Renting a car in one country and handing it back in another country is often more expensive; however, shop around. You can visit all the major towns on the way if you take the train; a car is only useful if you want to make a detour inland, or stop in the middle of nowhere.