I'm assuming by your post that you were unable to locate this tag ... correct?
Turning off the location setting on your iPhone would potentially only thwart the owner of this AirTag to not get location information updates by using your phone as a relay to the Apple servers. This is where they would see its location (actually your iPhone's GPS location) with the Find My app on their iPhone,
You would also need to disable "Find My Network" on your phone to remove it from participating in the Apple's "Find My network."
- Settings > Your Apple ID > Find My > Find My iPhone > Find My network
If you have an iPhone 11 or newer phone, you can try using "Precision Finding" to locate this AirTag.
Ref: Find your keys, backpack, and more with AirTag and Find My - Apple Support
The other thing to realize is that if you live in a location that has numerous folks nearby, like in an apartment complex, one or more of them may have an AirTag that is within the Bluetooth range (30-40') of your iPhone. This may also be the reason you are getting this alert. In this case, no one is stalking you.