Remove separator and last opened apps from the dock
Drag the folders away from the Dock and wait until the cursor changes to indicate they will be removed, and let go. You have to do this one at a time for folder stacks as Monomeeth says. 

To prevent minimized windows from showing to the right of the separator, go to System Preferences > Dock and check the “minimize windows into application icon” setting.