The Dock in macOS Mojave has a new, very helpful feature: It now displays recently-used apps. It’s handy when you’re going through a phase of using a particular app frequently, but you don’t want that app to appear in your regular Dock lineup.
Recent apps is on by default, and they appear on the right side of the Dock in a section marked off by horizontal white lines. In the Dock’s default setup, recent apps appear in a section between the Settings and Downloads icons.

The Dock shows the three recent apps that you’ve used; if a recently-used app already has a home in the Dock, it doesn’t appear in the recents section. (In case you’re wondering, recent apps, documents, and servers are still available in > Recent Items.)
If you don’t want recent apps to appear in the Dock, here’s how to turn it off. You can use these instructions to turn it back on, too.
How to turn off/on recent apps in the Dock
1. Open System Preferences (Apple menu > System Preferences)
2. Click on Dock.

3. The last setting in the Dock perferences is a checkbox for Show recent applications in Dock. It’s checked by default. Unchcked the box to turn it off. Check the box to turn it back on.

4. Close the preferences window.