There is a technique called “Focus Stacking”. It allows for greater depth of field when shooting Macros or Closeups. A lens that can focus close will have very narrow depth of field so that only one distance is focused and anything closer or farther from that narrow focus distance will be out of focus.
If you take several shots of a subject focusing on different parts of the subject, you can combine these to make one image that is in focus from front to back. There are several methods to achieve this.
There is the hardware solution which handles this in camera with either an attachment such as the Helicon Focus or Zerene Stack or in camera solutions such as the utility in the Nikon D850, which controls the focus of the lens and takes a series of images, or there are software solutions such as Photoshop that have stacking utilities within the program.
There are many tutorials online that show you how to make an image from a focus stack. Here is one that I did using manual focus, a tripod and a remote trigger. The final image was stacked using 6 images.