Without using families, which are available only in the paid version, you will need to know the IID of each instance you want to compare.
With the IID you can reference specific instances by adding (IID) before the fullstop.
e.g. sprite(0).X and Sprite(1).X
To get the distance between object IID=0 and object IID=1 you would use:
distance(Sprite(0).X,Sprite(0).Y,Sprite(1).X,Sprite(1).Y)