Both Harry Potter and LOTR have very immersive worlds and, if I'm honest, I find Harry Potter's characters more compelling even if LOTR is by far my favorite fantasy series out of the two.
Keep in mind that one was first written by a single mother living on state benefits while the other was written by a language professor who was also a war veteran. Very different people, and understandably, very different books. LOTR has unparalleled depth of world-building while Harry Potter has widespread appeal across multiple demographics (which doesn't automatically make it garbage, contrary to popular belief)