You can easily and quickly access your favorite apps, folders and files via the Dock. Since macOS Mojave, your recently used apps are also displayed, which can be found on the right side of the Dock. You can recognize the recently used apps from the iPad, where the function has also been available since iOS 11.
The biggest advantage of the Dock is that it is always in the foreground and that you can quickly switch between macOS apps. However, many users find the feature annoying because the contents of the Dock are constantly changing. Do you like structure and don’t want to use the recent apps? Then you can hide it on your Mac.
Disable recent apps in the Dock
- Open  ▸ System Settings
- Navigate to ‘Desktop and Dock’
- Turn off the ‘Show recommended and recent apps in Dock’ option
Under macOS Big Sur and Monterey you can find the settings via  ▸ System Preferences ▸ Dock and menu bar ▸ Show recent programs in the Dock. Do you have macOS Mojave or Catalina installed? You can then find this option via  ▸ System Preferences ▸ Dock ▸ Show recent programs in the Dock

Immediately, the recently used apps will be removed from the Dock and only your favorite apps, folders and files will be displayed.
Well separated
If you’re going to customize the Dock on your Mac, it’s good to know that apps can only be placed to the left of the divider. Folders and files can only be placed to the right of the dividing line. The trash cannot be deleted.