Does the iPhone GPS work in an airplane cruising between 30000-40000 feet?
For most practical situations, GPS will work well enough for you to track your progress but not have great coverage (less than 2m accuracy) or accurate speed over ground readings from iOS.

From an antenna / physics perspective, you may have horrendous GPS reception since you are riding inside a mostly complete faraday cage. Even if you have your phone in a window, all the visible satellites might be in a configuration where GPS is very poor or unable to generate a usable fix.

Clearly, cruising altitude is generally one of the best places for GPS reception as long as the antenna is placed on a tip / extremity of the plane. You don't have multi path interference to speak of, no foliage, and no hills or buildings to interfere with a clear view horizon to horizon - not to mention that your altitude will let you see more than the normal "half the sky" visibility you get on the ground at best.

The phone hardware and iOS will certainly try to get you the best fix it can once you have the device out of Airplane mode. I know many pilots that report the iOS GPS in the cockpit is quite good / on par with the other consumer and even commercial navigation products.