Remove margin reserved for dock when dock is hidden
Reboot.
Sometimes, settings don't come into effect until you reboot your device, especially if it's a system-wide preference. Rebooting tends to solve most System Preferences-related issues.
Also, System Preferences may not tell you to reboot your device, but if something isn't working, restarting should solve your issue.
If Dock settings do not work correctly, a reboot should solve your problem.