We had one SIM card that worked in both countries during our May 2023 France/Spain trip. The plan we used was Bouygues Telecom My European SIM 30GB, which was a fairly generous data plan for a one-month trip.
To do this before your trip, go to https://www.simoptions.com, then search for Bouygues Telecom, which is a French company. That was a better option for us since most of our trip involved travel through France, with only 8 days in Spain (while in País Vasco). We were careful to limit use of data while in Spain so we wouldn't exceed our 30 GB.
They sent a physical SIM card via US Priority Mail (for additional fee) to our home address a month before our trip, so we were ready to roll once we arrived in France. Things may have changed since then, and e-SIM is becoming more common. Depends how new your phone is, whether you have e-SIM capability, whether you have more than one port for a physical SIM card, etc. We used my husband's phone (which is newer than mine) because it has 2 SIM card ports and an e-SIM for use while at home. It was nice to not need to remove one's "home" SIM card, as would be the case if using an older phone with only one SIM port.
It worked great for us, although about a week after our arrival in France, we got a notification from Bouygues Telecom asking to verify our whereabouts (where we were staying, etc), which seemed odd. How to respond and interact with them was a bit confusing because of the language barrier, but we were able to resolve the matter quickly by asking our hotel concierge in Bayonne for assistance.
BTW, if you don't get a lot of responses to your query, you might try posting this to the "Technology Tips" category, although I have a feeling that you may already have enough info now to help you move forward.