Terrain has a movement cost and units have movement points. Each of the costs now round down in Civilization VI, instead of previous games where the movement would round up, meaning that if a unit has a single movement left and the Terrain costs more than 1, the unit will be unable to move there. Open terrain, like Plains and Grassland, only consume 1 movement point, whereas more difficult terrain, like Woods and Hills, will consume 2 or more movement points.
It is best to use caution when moving close to enemy units. Doing so will often force the unit to be in the enemy's zone of control (ZOC), restricting its movement. If a unit has movement leftover when entering an enemy's ZOC, its movement is stopped or it may attack.