Hiring a car in Spain and leaving it in Portugal will incur a hefty one way drop penalty. Try doing a dummy booking on something like holidayautos.com. I have just tried this for a random week in June and the difference is £120 vs £550 for the same car. You can usually hire a car in Spain and drive it into Portugal or vice versa, but some companies charge an additional daily fee for this coverage.
Look at rome2rio.com for route options. I would look to take the train or bus from Santiago to Porto then hire a car for the Portuguese element. Where abouts in the Algarve do you want to visit? End of June is peak season, so you will need to book accommodation soon, as many places will get booked up.
I like Tavira, which retains some character, unlike most of the Algarve. I also like the beaches at the western end - Furnas, Figueira, Zavial and at Carrapateira. Further north, the cliffs and beaches are great at Zambujeira.
Public transport isn’t great on the Algarve, so you really need a car to explore.