The devices measure distance based on the signal strength received on the device.
Note) Because Bluetooth is a radio-wave based signal, phone cases (especially metallic ones) that cover the receiving end of the Bluetooth module can alter the input values of the signal.
For iOS devices:
According to the official documents released by Apple, the accuracy values shown when ranging are approximately 68% precise — the accuracy applies similar to Android as well.
For Android devices:
Depending on the service carrier or manufacture of Android devices, the received signal strength tend to vary by a big margin.