Some sources say to never zoom with a smartphone camera, but these days that advise is not always correct. Many phones, including the iPhone X and Samsung Galaxy Note 8, include secondary cameras that provide 2x optical zoom. There’s no reason you shouldn’t use those cameras, as they provide an optical zoom without the loss of image quality.
Instead, what it is advised that you do not digitally zoom. This is what happens when you pinch or swipe to zoom on most phone cameras: the phone simply enlarges and crops the output from the sensor before the photo is captured.