The time you spend at each place could affect being able to get there and back, and we needed all day just to fit in both locations, plus a fair amount of driving. We actually came from the west, leaving our hotel in San Sebastián in the morning, driving the rental car we’d picked up a few days earlier, and spending a fair amount of time at the museum in Figueres. There was a parking garage, so we didn’t have to spend time searching for a parking spot.
Afterwards, we made it to the house at Port Lligat, and had enough time for a quick visit, but we arrived there shortly before closing time, so we closed the place down. This was October, with few other visitors, and it was getting dark surprisingly early; we got back to our car with just a little daylight left. We parked quite close to the house, but while getting to that small lot, we passed a lot of big parking lots on a long road. I imagine that in High Season, the place must get busloads of tour groups, and a lot of other visitors in lots of cars, with a lot of parking space needed to accommodate everyone.
As it was getting dark, we found a place for the night just outside Cadaqués. If we didn’t have that place to ourselves, there was maybe just one other occupied room that night. We had dinner in Cadaqués, and left the next morning for Girona, with Barcelona a destination the day after that.
So we spent enough time at the two Dalí places, having headed from San Sebastián, not Barcelona, that an all-in-one-day trip wasn’t doable. If you have the means to stay a night in Cadaqués, that would make the trip more feasible. Could you do this either before or after your Barcelona stay? And we dropped off our rental car one train stop north of Barcelona, and took the train into town - it might be easier to pick up a car just outside of the city, too, and avoid driving in the city itself.
And if you wanted to score the Dalí Trifecta, there’s also the Castell Gala Salvador Dalí de Púbol, in Púbol, just outside Girona. He lived there, too, and his wife Gala is buried there. If you were able to see just the 2 places you mentioned, and go from and to Barcelona in a single day, that would be surreal! 👨🏻🎨