There are many reasons why this band of altitudes are optimal for commercial flight. One reason, though, governs and it’s due to not aircraft design, but human physiology.
By 10,000 feet, most people, including pilots, are feeling the effects of altitude. In an unpressurized aircraft, this is about where you’d start breathing from a supplementary oxygen source. The air pressure at this altitude is about 20 inches of mercury. As oxygen is roughly 20% of the air, that means the oxygen has a partial pressure of about 4 inHg. This is a baseline for the minimum oxygen a pilot needs to function.
At 40,000 feet, the air pressure is about 5 inHg. That means that if the pilot is breathing pure oxygen at this altitude, that person is still only getting 4 to 5 inHg of oxygen. As noted, this is the limit for pilot performance.
Ordinarily, a jet at 40,000′ is pressurized to a cabin altitude of 8,000′. This is, of course, why you need not wear an oxygen mask in a jet. Faults do happen, though, and the crew needs to be prepared for a cabin depressurization. If that happens, the crew immediately don oxygen masks and start breathing pure oxygen.
As a result, the FAA effectively limits commercial passenger flight to 42,000′. Above that altitude, the pilots would be unable to control the plane in an emergency because they would have insufficient oxygen to breathe, even on pure oxygen.
Why get up there in the first place? Efficiency. The same thin air that will kill you as a human makes for minimal drag for the plane. As a result, given the 42,000′ limitation, jet aircraft designers optimize for the 30,000′-40,000′ altitude band.