Last of 3 articles explains how macOS selects and starts the app with which to open a document which you double-clicked/tapped.
sharedfilelistd
Digging into macOS Sierra and its logs to examine how Recent Items works. Useful insights into Launch Services, and potential historical info about documents opened.