
Well yoru alowign the smaller dog 5 inches above with3er height and only 4 inches for teh taler dog.
If your building them in I would go for at least 26 inches for the bottom one and that woudl still give 4 inches clearance for the smaller dog, which arguably needs a smaller proportion of headroom, if you get what I mean.
4 inches is a smaller proportion of 21 inches than 5 inches is of 17.
5 inches as a proportion of 21 inches is 23.8%, and 4 inches of 17 is 23.5%, which seems more appropriate than the above which would be 19% and 29.4%.