[distance] Add variant support

Add variant dispatch layer to the distance algorithm