The closer you shoot, the thinner the "sharp slice" in a single photo. Focus stacking takes one photo at each distance and merges the sharp parts.
A camera can focus on only one distance at a time. Things a little nearer or farther gradually blur; the range that still looks sharp is the depth of field.
The closer you shoot and the larger the subject appears, the thinner the depth of field. For close-ups of stones, insects or jewellery it is often much thinner than the subject itself, so one photo cannot show the whole thing sharp.
The app takes a burst, focusing at a different distance each time from the nearest part of the subject to the farthest, then keeps the sharp part of each photo and merges them.
The number of photos depends on how deep the subject is and how thin the depth of field is: deeper subjects and closer shots need more photos and take longer to merge.
These are the basic principles. The best way to shoot depends on you and on the subject — try a few times and you will find your own way.