I'm primarily talking about stuff like step counters, but also health apps measuring your heart rate, how many stairs you take, the length of your steps, and so on. I'm honest when you tell me to explain it to me like I'm five years old, this one boggles my mind.
Step counters use the phone accelerometers which the phone also uses to notice its own orientation. They measure longer distances with GPS. I haven't yet seen a phone that can detect your heart rate by itself. Some wristwatches/fitness bands do it using an electrical sensor (electromyograph) on your wrist, and send the info to your phone by Bluetooth.
I think one of the Pixels or one of the old nexus devices could read heart rate through the camera somehow, but you had to put a big fingerprint on the lense so it was useless to most people.
Samsung phones used to be able to measure heart rate along with blood oxygenation. Not sure when they stopped, but I know one of my old galaxy's had it, either the 5 or 8.