The motion coprocessors in all iPhones with the A7 chip or higher are great for use in counting steps, with the resulting data readily accessible in the stock Health app. However, the accuracy of this data can differ to a surprisingly large degree depending on where you keep your iPhone when walking.
Apple has said that the motion coprocessor will deliver the most accurate step counting when the iPhone is in your pocket or an armband. Apparently, the step counting can also be triggered by movement it senses from your arm or leg swinging; therefore, keeping the device in your backpack will lead to inaccurate logging.
There is anecdotal evidence that the type of pocket can make a difference, too; one user on Apple’s Communities forums has found, for largely accurate tracking, a jacket’s side pocket to be “hands down” a better choice than a cargo pocket or a side pocket on a garment other than a jacket.
Keep that iPhone in your jacket’s side pocket and you could even find the step counting to come very close to that of a dedicated fitness tracker, judging from Engadget writer Kelly Hodgkins’ findings. Nonetheless, a wearable fitness tracker could remain better for all-day-round step counting.