I struggled with merging focus-shifted images using Photoshop and Affinity Photo but found success with Helicon Focus, though with some limitations. I then discovered focus-stack on GitHub, a simple command-line tool, which was comparable to Helicon Focus.