You can fix recording latency after the recording by doing latency correction.
To fix playthrough latency, monitor in hardware. Either unmute the input in the playback side of the sound card or in the playback side of the Windows sound control panels (usually not possible on modern computers) or buy a USB interface or USB microphone that lets you monitor in the headphones input of the device.
If you need more help, please state what version of Windows, what version of Audacity and make and model numbers of your recording equipment. See the pink panel at the top of the page.
Part of the overdubbing tutorial has three certified hardware devices that will allow perfect overdubbing—a live, theatrically correct headphone feed of your overdubbing session. They all make you listen to the device, not the computer.