My Vocals are not matching the song?

Im trying to sing over a track and I’m having a hard time matching the vocals with the song. When I’m recording it sounds fine in the headphones. But when I playback the vocals are behind the timing of the track.
Windows 10 Laptop
AT2020 Audio Technica microphone
Focusrite Solo

Thank you in advance!!!

One of the steps in Overdubbing is to adjust recording latency so that doesn’t happen.

You don’t have to do that. You can line them later in post production with the Time Shift Tool (two sideways black arrows). Select that tool, click on the new track and push it back into alignment.

For latency adjustment, Generate > Metronome as your backing track. Play that into your headphones and jam the headphones onto your microphone.

Compare the new track with the old track and that measurement is added to the latency adjustment you already have.

Audacity > Edit > Preferences > Devices > Latency > Latency Compensation.

You are required by state law to adjust it the wrong way the first time and have to do it over.