Should I use Civi::settings()->get and set or
One option is to create settings using Setting Reference

How I would do through extension is


Register metadata for setting using hook_civicrm_alterSettingsMetaData
To set the setting using civicrm api 
code:

civicrm_api3('Setting', 'create', [
  'setting_name_goes_here' => 123,
]);
To get the setting using civicrm api

civicrm_api3('Setting', 'getvalue', [
      'name' =>'setting_name_goes_here',
    ]);
If you want to add this setting on one of the Admin config form then below is a good example on how you can do it.(New version of CiviCRM provides more flexibility to add settings to UI by appending settings in $form->_settings in preprocess hook)


https://github.com/JMAConsulting/biz.jmaconsulting.easybatch/blob/master/easybatch.php#L140
https://github.com/JMAConsulting/biz.jmaconsulting.easybatch/blob/master/easybatch.php#L116
https://github.com/JMAConsulting/biz.jmaconsulting.easybatch/blob/master/easybatch.php#L304
https://github.com/JMAConsulting/biz.jmaconsulting.easybatch/blob/master/templates/CRM/EasyBatch/Form/Admin.tpl