In Coimbra, I stayed at the Hotel Domus a few blocks from the little Coimbra train station (not the big "Coimbra-B through station). It was a small family-run place (the manager lives there with is family) with ancient furniture but clean and comfortable in an awkward "haven't redecorated in decades" way. On the upside, it was super cheap. Coimbra is not a tourist town, and there aren't a lot of really nice hotels. There are some cheapy places like this (I think I paid 40 euros/night; walked up without a reservation off the train). I spent two nights, and realized only when I got to Porto that I'd left my tripod in my room back at the Domus! I decided to train all the way back to get it. The owner was nice enough to keep it for me, at least.
If you don't want to stay at the Domus, you shouldn't have trouble finding a place nearby that fits your budget. It was barely a ten minute walk from the center of the old town and super convenient if arriving by train (if you arrive by bus, be prepared for 15-20 minute walk from the bus station back to the train station. I took the train from Tomar with a change in trains.)
I stopped in Tomar for a few hours off the train (detour) headed to Coimbra and also day tripped to Nazare (from Coimbra by bus) for a few hours.
Tomar is super small. Because there is no official bag storage at the train station, I left my bags at the Hotel Trovador a block from the station. They were really nice and refused to take any money just to hold my bags for a few hours. I never saw a room, but at least I can say it's probably a very friendly place to stay. However, even though it's just a short walk from the train station to town, I'd still probably stay in or near the center of town if possible. The town is pretty small, anyway. I'd want to be in the center unless it was expensive, at a B&B or something if not a cheap proper hotel, near the The Church of Saint John the Baptist down below the convent and castle.