Swapping a car for another car and paying the difference (in balance) to one of the parties is a valid contract that is permissible because the situation of the contract is valid.
A confirmed narration from the Messenger of Allah (peace be upon him) is that: a gold should be paid for by a gold, payment being made hand to hand, equal for equal, silver for silver, hand to hand, equal for equal. In other authentic narrations too: do not sell gold for gold, nor silver for silver, except payment is made on spot, equal for equal.
When the classes differ, sell as you wish if the payment is made on spot.
This hadith is strictly on money exchange, gold, silver, and food, but cars are not in this category; likewise lands and the likes as been mentioned in the hadith.