In the United States, yes, at least for your phone’s cellular connection. FCC rule 47 CFR 22.925 says cellular telephones carried aboard airplanes, balloons, or any other aircraft must not be operated while the aircraft is airborne, and that once an aircraft leaves the ground, all cellular telephones on board must be turned off. Switching on airplane mode is how passengers meet that rule, because it shuts off the phone’s cellular radio while the rest of the device keeps working.
The rule’s required cabin notice warns that breaking it “could result in suspension of service and/or a fine,” and adds that using a cell phone while the aircraft is on the ground is subject to FAA regulations. In practice, whether you may also use onboard Wi-Fi or Bluetooth headphones during the flight follows your airline’s policy and crew instructions.
Image: “Delta 767-400ER Economy Cabin” by Vincent Desjardins, CC BY 2.0, via Wikimedia Commons.