All other factors being equal, taller uprights and longer grands sound better, particularly in the bass and mid-range, than smaller or shorter ones. This is due to the physics of piano strings, which dictates that longer strings produce a more harmonious sound. In some cases, the larger pianos may also have better keys and actions. Of course, unless you’re comparing different-size models of the same brand and model line, all other factors are rarely equal, so one should not pursue size to the exclusion of other attributes, but as a general rule of thumb, when it comes to selecting a piano, bigger is better.
Verticals (uprights) and grands come in various sizes that are called by different names. Speaking very generally, most vertical pianos purchased are from 43 to 52 inches tall, though ones both shorter and taller are available, especially among used pianos. Most grands fall in the range of 5 to 7 feet long, though ones as short as 4½ feet and as long as 10 feet are available. The shortest pianos are primarily for very casual and furniture-conscious use, the tallest or longest for professional and concert use. See this article in “Piano-Buying Basics” for more information.