How to stop the player when it reaches a certain position?

Hi, Can someone teach me how to stop player when it reaches a certain position.

if (transform.position.x < 100f)
        {
            //Make the player stop when it reaches a certain position
        }

if (transform.position.x < 100f)
{
transform.position.x = 100f;
}

easiest way, you could also use an invisible collider or disable the controls, really depends on how you want the game to react.