What is the difference between the $config and the $settings variables in settings.php?
Settings are for early-bootstrap (you can't store the database credentials in the database) and environment specific things, like the path to the public file system. Things that are not meant to be exported/deployed.

That means in almost all cases in modules, you want to use the configuration API.