Are you building for blackpowder or composites?
Other than Cesaroni composite reloads (which not too many people fly due to expense and HAZMAT) there aren't 24mm motors longer than 3.75 inches. That gets you up to a midrange F in composites.
In larger diameters you typically have larger motors stick out the top of the mount. However in 24mm many motors do not have thrust rings at the nozzle so you typically use a motor block positioned for 3.75 inch motors and add a 1" spacer to fly shorter ones (e.g. C11 & D12 in Estes and E15, E30 and 24/40 loads in composites.) Such spacers are included in Estes E kits or can be made from 1" off a spent motor.
In answer to your second question I've never really learned a good rule. With BP you almost always want approx. the length of the motor but composites you can make it much shorter.