An airplane relies on the lift from its wings, which depends on the airplane’s speed and the air density. As a result, a cruising airplane will fly at a constant altitude, following the curvature of the Earth.
Flat-Earthers claim if Earth is a sphere, an airplane has to dip its nose down periodically, or it would fly into space. In reality, an aircraft will follow Earth’s curvature and is unable to fly to space even if the pilot deliberately attempts to do that
The higher the altitude, the less the air density, and therefore, the smaller the lift an airplane gets. At some point, it will not be able to generate enough lift to counteract its weight, and the aircraft cannot go higher.
The higher altitude, the amount of oxygen becomes smaller. As a result, the thrust generated by the engines will also be lower.
If the airplane is angled toward space, its orientation will form an angle to the direction of its weight. As a result, the component of lift that counteracts gravity also becomes smaller.
Except for some fighter aircraft, the thrust generated by the engines is lower than the weight of the plane. The force from the thrust by itself will not be sufficient to bring the aircraft into space.
Commercial aircraft are engineered to have longitudinal static stability. It will restore its orientation relative to its center of gravity when there is no input from the pilot.
Because of these reasons, an aircraft will follow the curvature of the Earth, and will never fly away into space. Flying into space is not that easy: you will not be able to fly into space ‘by accident.’ It will require a significant amount of energy and is far more expensive than any commercial flight.