With DSLR there are mainly(but not limited to)/most popular two type of systems depending on sensor size I. Full Frame II. APS-C
Full Frame(FF) camera has 35mm sensor, wile APS-C/DX sensor are smaller. So, FF sensor camera will need bigger circular area from lens, while APS-C sensor camera will need smaller area.
Providing bigger circular area means more weight, cost,etc. So, lens are made for APS-C sized sensors are naturally cheaper, lighter.
As FF is bigger size you can use FX(Nikon)/EF(Canon) lens of lower end DX/APS-C sensor camera. But you can't use lens made for DX/APS-C camera on FF(Technically, you can. But then you will get huge vignetting in your picture.). This is simple physics, it's won't change if manufacturer changes.
Be it Canon, Nikon lens made typically for smaller sensor camera won't work on FF camera.
How to avoid your problem? Well , get lens made for FF camera. So, even if you upgrade your camera to FF, it won't be a problem.
With Nikon, there is another thing to consider. Autofocus motor. Lower end Nikons D3100, D52000 don't have in-build autofocus motor, so you have to buy lens with autofocus motor only(Yes, you can manual focus anytime).
Other great thing about Nikon is, F mount has been used since film era i.e Since 1960's. So any lens made by Nikon will be work on your Nikon DSLR! Canon changed mount when going digital, so this won't apply here.
e ef s lenses can be used on amy cannon camera without any problems is it true
Well the opposite is true. EF lens can be used on any Canon DSLR. EF-S for APS-C, EF for FF.