How to get rid of 'recent windows' section in macOS dock?
Solution 1:
If you do not want to see the application icons as shown in your first screen shot between the Trash and the vertical bar to the left, then check:
[√] Minimize windows into application icon
As shown in your second screen shot.
For any existing windows you need to un-minimize them and re-minimize them so the existing ones will no longer show.