This example expression positions and maintains one layer at a balanced distance between two other layers.
(thisComp.layer(1).position + thisComp.layer(2).position)/2