I have an O8 Sonata, automatic transmission. Transmission shifts to neutral and shifts the gear again when I release the fuel pedal.
You’ve got a transmission problem or you’ve got a motor on the transmission that is broken and jerks. Pray it’s the mounts, because if it’s the transmission on that, you’ll spend more money on rebuilding the transmission than the vehicle is worth. Have the motor transmission mount checked. Hope that one of them is just broken and jerks and falls in and out of gear. I have seen that happen.