The Hyundai Sonata has a known issue where the metal contacts inside the dome light stay in contact regardless of the on/off switch, which makes the light stay on. While you could do some home remedies by taping off part of the contacts or bending them with a narrow tool, the best fix is to simply buy a new dome light.
You can buy a new dome light for a Hyundai Sonata for somewhere between $30 and $50 depending on the model year. It’s easy to install as it only requires you to clip in a wiring harness and pop the light fixture into place.