Not sure what 'all else being equal' means. Type, size, diameter, rotational speed, power, air gap all are variables. Application usually sets compromises.
You have to have a certain amount of core area for a given power motor to keep flux density within capability of core material used.
Brush based, AC-DC motors usually have longer length but more due to application limiting desired diameter. (like hand drill) For a necessary hp motor, if you don't want too big a diameter then you lengthen the core. It may take some hit on efficiency over a larger diameter shorter motor but also depends on rotor gap and rotational speed.
A high rotational speed motor can have more air loading loss in a large diameter motor. In this case a longer, thinner motor may be more efficient. But maybe you want this to help cool the windings.
A small motor, like vibrator motor in mobile phone the air gap become a dominate factor. This along with application looking for thin motor drive long narrow form factor.