I've been using my D3100 for nearly 11 years now (after my first D40X was stolen) and have upgraded with a refurbished D5300 to access the later processor and focussing capabilities. I assumed all lenses were cross compatible but it seems not to be the case.
I've been using a Nikkor 18-105mm AF-S and a Sigma 70-300mm Nikon F mount lens with my D3100.
D5300 has come with a Nikkor 18-55mm lens which looks like an updated version of the original 18-55mm kit lens but is badged AF-P rather than AF-S.
The 18-55mm AF-P will autofocus with the D5300 but not the D3100.
The 18-105mm AF-S will autofocus with both bodies.
The Sigma 70-200mm lens will autofocus with D3100 but not the D5300.
It seems strange that if one lens is compatible with both bodies then all of them aren't.
Is this a compatibility issue or is there some other factor coming into play? One of my reasons for buying a secondhand D and not going down the Z route was becasue I didn't want to have to replace lenses (especially the Sigma) as well.
The contact points on the two Nikon lens look identical. The Sigma is a bit different as it has 10 rather than 8 (I guess for other manufacturer's cameras).