The short answer
Your iPhone and Apple Watch do not share one physical step sensor. Each can record step data from its own hardware and write samples to HealthKit, so a device-specific total can differ from another device’s total.
HealthKit knows where samples came from
HealthKit sample metadata includes source information, and Apple explicitly describes sources that can represent an iPhone, Apple Watch or other hardware. Apps can also query which sources have saved a particular sample type.
What a step app should show
For a normal daily total, the useful question is usually “what does the HealthKit store say for this period?” rather than “how many steps did this one device record?” Device-source views can be useful for diagnostics, but they should not be confused with the person’s overall HealthKit total.
Primary sources: Apple — HealthKit sample source · Apple — source queries