chick the distance between players position.x and enemys position

so i tried using this code below but it only works with position not position.x and x is what im trying to find any help

if ( Vector3.Distance(player.position, transform.position.x) > 5) {

	//transform.Translate(-1,0,-1);
//	transform.Translate (-1,0,0);

}

The Distance function is something like Distance(VectorA, VectorB) = (VectorA-VectorB).magnitude;

So it’s not going to work with a vector and a float. If you want a distance 1D, it’s pretty simple :

if( Mathf.Abs(player.position.x - transform.position.x) > 5 ) ...