Use distance() expression, with either tilemap indices or layout coordinates.
For example, to check if tiles A and B are adjacent, you can use this condition:
distance(Ax, Ay, Bx, By)<1.5
Where Ax,Ay,Bx,By are their indices on the tilemap.
Or, for example, to check if mouse cursor is on an adjucent tile to tile A:
distance(Tilemap.TileToPositionX(Ax), Tilemap.TileToPositionY(Ay), Mouse.X, Mouse.y)<(32*1.5)
32 is tile size in pixels.
.
To scan a block of 3x3 tiles around mouse cursor for a particular tile ID: