You might lose your right for the occupied property by prescriptive easement (non-excluisve) or adverse possession (exclusive use). However, both cases requires the occupation by non-owner to be "hostile", meanning without permission.
You can prevent prescriptive easement or adverse possession by giving express permission. For example, you can sign an agreement with your neighbor saying
1. The neighbor, acknowledge the fence was in the wrong place.
2, The rightful owner, give the neigbhor permission to use occupied land to save cost,
3. in exchange of promise of replacing, in the future, the fence at the correct location instead of the present location.
This is not legal advice, please run this by a real estate lawyer to make sure it works in your jurisdiction.