Figuring out the right driver shaft length for you and your game is not a simple solution. There are a number of factors that go into deciding the proper shaft length with the big stick.
Before we go any further, the Rules of Golf tell us the maximum driver length shaft is 48 inches. Brooke Henderson uses a 48-inch shaft on the LPGA Tour, but she's rare among pros. There isn't a minimum length, though players typically do not swing a driver shaft that is shorter than their next longest club, usually a 3-wood. These days, 3-wood lengths range from 42.5-43.5 inches.
Back when steel shafts were the only real choice, a driver shaft length was typically in the 43.5-inch range. These days, graphite shafts typically land in the 44-45.5 inch range. It depends on the manufacturer and what they're trying to achieve with the stock shaft choice and their head design. If distance is the goal, and it almost always is, the shafts are usually in the 45-inch-and-up range.
So, what is the correct driver shaft length for you and your game?
That depends, in part, on how well you typically hit the ball. If you hit the ball well, then a longer shaft, which will inherently generate additional swing speed (because you have more time to generate speed), shouldn't be a problem. You'll gain yards with each additional half-inch in driver shaft length, but that gain gets smaller as the shaft length gets closer to 48 inches.
However, the additional swing speed tends to come at a price. A longer driver shaft is harder to get back to square consistently, meaning you're more likely to spray the ball with a wider dispersion pattern and not hit it quite as consistently. That means you may miss more fairways and have longer approach shots from the rough.
When getting fit for a new driver, try multiple shafts and see which one works best for you on a launch monitor. In picking a shaft, you're looking for flex characteristics, torque, weight and length. Once you dial in on a particular shaft, then you can work on figuring out the right shaft length to determine which you hit the best and most consistently. If you're willing to give up a fairway or two per round in exchange for some extra yardage off the tee, use a longer driver shaft.
Don't let your height automatically box you into a certain driver length. Everyone's swing is a little different. Some shorter players swing wide and can handle a longer driver shaft. Some taller players have a shallow swing that make a shorter club reasonable. Let the launch-monitor data guide you.