I've heard that the autofocus (and maybe other features) on the more expensive Nikon lenses don't work on the D3500. Is the same thing true with the D5300?
Nikons' web page for the camera will have information on what lenses will and won't work with the body, as well as lenses that may have limited functions. The instruction manual also contains this information.
Ken Rockwell is a good resource on lens comparability. Click on dslrs then look about 1/2 way down the article for the table at Nikon Lens Compatibility . Basically anything labeled AF-S or AF-I will autofocus in all modes as long as it's a G lens or later, VR should work on VR equipped lenses, the newer AF-P glass should work. Stay away from Pre-AI, AI, AF and AF-D glass. Pretty much the same list for the D5300.