I spent three or four nights in each of Coimbra and Guimarães on my 2017 Portugal trip, and four nights in Coimbra once again just last December. I think both cities are great, and the choice between them is practically a toss-up. You could tape a Portugal map to your wall, throw a dart, and choose whichever of the two cities it lands closest to! But as that advice may not be helpful, I'll add that I would probably have a slight preference in favor of Coimbra, partly because it has its own style of fado, and a few venues in which to experience it; and also because I enjoy getting lost, or at least trying to, while wandering "flâneur"-style among the narrow, humble streets of old medieval centers -- and Coimbra, the larger of the two, has more old historic space in which to wander.
It appears that Guimarães has been "discovered" by day-trippers from Porto, but this does not mean it's worth only an afternoon. In fact, at the time of my visit (again, nine years ago), I found that two full days (i.e., three nights) could easily have been justified just to see all the "tourist stuff" on offer at a leisurely pace. This included three museums, a castle, a fifteenth-century manor house, several old churches, a funicular ride to a hill-top view point, and the quaint historic center itself. Spare time was easily filled with long lunches at any of a number of nice sidewalk cafes in the charming old plazas.