Have you purchased the flights yet? If not, I strongly agree with Jaime. With such a short time, you will not really have time to visit the loveliest of the beach towns near Barcelona, which are on the Costa Brava, north of Barcelona. To reach the towns near Begur will take you about two hours from Barcelona airport, each way. In August, those towns will be absolutely jammed. (The hotel we stayed at just this past September is already mostly booked for August and I expect other hotels will be as well.) You cannot visit the Costa Brava from Barcelona on a sensible day trip unless you. head for the southernmost towns which are the least attractive and will be the most crowded. South of Barcelona the beach towns are nice but not worth flying there just to spend time on them and after that, be faced with a long slog south to the Cadiz area.
I know the coastal areas near Zahara de los Atunes fairly well and I, along with many travelers, put those near the top of the list for the best beaches in all of mainland Spain. You have only three days and there is so much to see around there, that it makes very little sense to waste all of your limited time driving on highways from Barcelona to that area, the Costa de la Luz. (Do not imagine sonic coastal roads..think large highways, with a substantial amount of time to reach the coast from the highway in many spots) Along that route, Denia is lovely but not worth the drive from Barcelona.
Are you planning to take public transport? Because if that is the case, you will be pretty stranded in Zahara; there are no trains to that town, or any others on that coast (except the city of Cadiz and nearby) so you will be forced to use buses which do not run often.
Close to Zahara, Conil (the only town close to Zahara) is lovely but by bus from Zahara it takes about an hour and I'm not sure coil Ofers anything much different than Zahara....... The Atlantic beaches of Zahara and adjacent Atlanterra are beautiful but you really need a car to visit places like El Palmar de Vejer, Zahora, etc. The larger town of Barbate is more workaday, rather than resort-like and it's possible to visit by bus. If you love tuna, Barbate is your place,, as it is world famous for its restaurants serving blue fin tuna is many guises.
I'm sorry to be harsh but I think you need to do more research. One option would be to combine Vejer de la Frontera with Zahara. There are about four buses a day between the two towns. Vejer is one of the prettiest of the "white towns" in Andalucia and far less overrun by tourists than some of the more famous names.
This is the bus company that services this area of Cadiz province; you can check the towns served by bus and the timetables.
https://www.tgcomes.es
The easiest way to visit Zahara is to fly to Jerez via Madrid and from that airport, take the train to Cadiz and move on by taxi or bus. Better yet, fly to Jerez, rent your car at the airport, and drive on to Zahara.