I'll just touch on a couple of things:
I would plan one base in the Valle d'Itria; you don't need to stay in both Ostuni and another place in the area.
On one of my first trips to the region, we stayed near Cisternino at Villa Cenci and I'm thinking of booking again when we return this fall. Take a look at the map and see the location. Anyplace in the general area gives good access to the towns that you will probably want to visit. There are SO many great places to stay around there; if you don't like one, you'll find another. Standard is very high for hotels in Puglia now.
Second, when you do your day trips from Matera (I think you have time for only one), keep in mind that things shut down in the middle of the day in Puglia even more so that in some other regions. So you either have to get out of the hotel early, or go late afternoon and have dinner. For example, Tursi: We had a great experience here, but we stayed overnight. The area you will want to see is very, very small. I wonder if it might make sense to go directly to Tursi from Bari, arriving late afternoon. (Maybe stopping in Altamura on the way, but being mindful of afternoon closures; maybe make second stop at Craco.). So arrive late afternoon in Tursi and see the town in lovely lighting; great views over the calanche, winding stone lanes, etc etc. Lighting would be important here if you want to take photos, even more important than other places, I think.
Then you check into your hotel in Tursi and go for dinner at PALAZZO DEI POETI. Make an early night of it and drive on to Matera the next morning. For me, taking day trips from Matera is a little more of a pain than from some other destinations, because we've always had to give up our car, either to the hotel parker who takes it away to their lot after unloading baggage, or to a garage with connections to a hotel. In the second case, you drive right to the garage, located in the upper town (do not miss this part of Matera during your wanderings) and take the hotel's shuttle to the hotel. So to leave Matera for a day trip you have to retrace those steps; it's not like your car is right there and you exit hotel, go to car, and drive out of town.
That's why I like the idea of taking the day trips either before or after Matera.
This is all a very easy area to drive in, even for me, and I am not a confident driver. Roads are great, drivers are polite, signs are good, and now you have GPS, which we did not have on our first visits to this region!!
Hope I did not go on and on and confuse you even more! I love this area of Italy and would be happy to recommend hotels if you like. We were last in Matera in 2023, and drove from there towards the Gargano with a few night's stay on the way....
Here is a report about that part of our trip, with a lot of detail about food and restaurants, since that's a big interest of mine; my photos are there, scattered in with those of others who commented on the thread. I should add that the food in Matera is FANTASTIC but do take care of which restaurants you choose. And our dinner in Tursi was one of the best of our entire trip!! You can skip the beginning of the thread, which talks about our visit to a farm near Senise that grows the red, Senise peppers, which I take home to cook with:
https://www.hungryonion.org/t/basilicata-three-nights-inland-between-maratea-and-canosa-di-puglia-including-2-nights-and-two-fantastic-dinners-in-matera-at-one-of-most-unusual-and-excellent-hotels-in-the-world/36261/17