This can happen, for example, if you record at 44100Hz, then play back at 48000Hz. It could also happen, for example, if you were in a Zoom meeting and Zoom changed your input speed to 32000Hz.
Be sure that all of your drivers are set up for the same speed. Look in the lower-left hand corner of Audacity for your current project rate. The default is 44100Hz. For your devices, in the search bar, run mmsys.cpl, then on the Recording Tab, AND on the Playback Tab, select your device, click Properties, then the Advanced tab and select the proper Default Format.