On our recent trip we stayed at the Parador in Córdoba, but we had been to the city on a few previous visits. It’s a couple miles from the historic center and we took a bus from it to Plaza Cölon for walking around town. The hotel is nice, but probably not one a first timer to Córdoba would want to stay at.
Closer to the historic center is the H10 Palacio Colomera. It’s right on a plaza and convenient for walking throughout the city. We stopped at it for an hour while waiting to meet a relative and it looked nice. There were plenty of restaurants and shops by it. The Mezquita is a 10 minutes walk from it.
While I’ve been to Granada a few times I haven’t been there since 2014, so cannot provide an informed hotel recommendation.
In each city there are plenty of hotels in all budget ranges to choose from.