(a) A sheriff's deputy may perform any duty imposed on the sheriff under this code.
(b) If there is no sheriff in a county, the duties of the sheriff's office relating to criminal law are conferred on the officer empowered under law to discharge the duties of that office when the office is vacant.