How to tell if 2 blocks are next to each other in a 2d game?

I am trying to figure out if two different 1x1 blocks are right next to each other. I just can’t seem to make it work. Here is a script that I tried:

#pragma strict
var Extractor : GameObject;
var Resource : GameObject;
 
function Update () {
if(Extractor.transform.position.x == Resource.transform.position.x + 1 || Extractor.transform.position.x == Resource.transform.position.x - 1 ){
    Debug.Log("Extract");
}
}

In this example if from a tile set of 2D sprites. Each tile checks to find its neighbor tiles.

I use 0.32 as offset in each direction since my sprite is 32px.

var marketArea : Collider2D[] = Physics2D.OverlapAreaAll( Vector2(transform.position.x-0.32, transform.position.y-0.32), Vector2(transform.position.x+0.32, transform.position.y+0.32) );
	
for (var i = 0; i < marketArea.Length; i++) {
	//Here I test it the collider next to the sprite has a tileBehaviour script
	// you could test for other things like tag or name
	if(marketArea*.GetComponent(tileBehaviour) ){*

_ Debug.Log("Current Market "+marketArea*.transform.name);_
_ marketPopulation += marketArea.GetComponent(tileBehaviour).population;
}
}*_