What is the best way to travel from Avignon to Barcelona?
The train. There is usually one direct train from the TGV station (there may be more) or you can go from the Avignon Centre station by way of a connection in Perpignan or Nimes.
There are 2 trains a day from Avignon to Barcelona. About 6 hours with a change in either Nimes or Figueres-Vilafant. There might be other options too but they would be slower with a change in Cerbere.
It depends upon whether you want to see anything in between. If so, rent a car in Avignon then drop it off in Perpignan to avoid a high drop charge in Spain. If it's just to get to Barcelona then take the train as advised.