Rock climber here. If you're trying to hang for extended periods of time, you're going to want to develop calluses. It is the body's natural response in an attempt to further protect you. This is the salve I use after climbing, if my hands hurt. It works well and you can buy it at pretty much any outdoors store: https://www.jtreelife.com/products/climbing-salve
However, I you don't want calluses, you could get some climbing tape: https://www.metoliusclimbing.com/climbing_tape.html
Pull ups or going to a climbing gym are going to help the most, as those activities will help build up the muscles you use directly for hanging, and the ones that help stabilize you. A second exercise might be to practice doing leg lifts while you're hanging, they will cause your body to swing a little back and forth, thereby causing activation in the stabilizing muscles and core. But make sure you've got some padding underneath you in case you slip off. It hurts... trust me. you could get a rock climbing crash pad, or just do one leg at a time.
10 seconds is a good start, and maybe doing those aforementioned exercises might still be too much at this point. If that's the case, just get a stool or something. By standing on the stool, you can essentially take off as much body weight as you want, and continue to hang. The farther away you place the stool from directly underneath the bar, the less assistance you'll get from it.
If you're super serious about extending your hang-time I'd buy a fingerboard. The kind like Metolius offer. They will build up your muscles like crazy.
Whatever you decide, be careful and take note of signs of overtraining. The potential risk is real, and when you're doing bodyweight exercises like these where you're working your tendons and putting a lot of pressure eon joints, it can easily sneak up on you, and put you out of training indefinitely. You can usually end up clocking in more hours training if you rest, instead of "powering through" and end up sidelined with an injury.