You have macOS.
You have a number of Safari windows open.
You wish to have fewer or no (added) windows open, and preferably no windows in the rightmost part of the dock.
These Safari windows happen when you open wensites in new windows, and when that window is then minimized.
For details on how to avoid opening a new browser window for each web page, and which entirely avoids loading up the Dock with Safari windows, click or tap on the following blue-text link > Use tabs for webpages in Safari on Mac - Apple Support
This link shows how to use Safari tabs, which means you can have one Safari window open. And should you minimize that, it won’t go into the rightmost section of the Dock.
There is a setting for the most recent applications in the Dock preferences, though that will effect all apps. And that won’t alter opening websites in windows, rather than opening websites in tabs. Click or tap for details > Open recently used items on Mac - Apple Support