The length of your driver shaft affects your clubhead speed. But, perhaps more importantly, it can also affect your ability to square the face at impact and find the sweet spot, upping ball speed and distance.
You might generate higher clubhead speed with a longer shaft, but if that comes with more toe and heel strikes, your ball speed won’t oblige. On the other hand, a shorter shaft may not up clubhead speed at all, but the improved control would benefit impact, increasing ball speed, smash factor and distance. So, shorter can be longer.