Using the safety ground on a three prong outlet is a valid way to ground yourself for ESD purposes. Many lab benches I have used have the ESD mat grounds attached to the ground that comes from a power cord feeding the benches.
You can also buy an ESD grounding plug for a wrist strap that plugs into the ground on an outlet. Here is one example.
https://www.amazon.com/Static-Desco-Ground-Adapter-Benches/dp/B0793LMXC8
If you are going to just use a regular extension cord, be very cautious of the fact that Line and Neutral are right there too. Make sure you go in the right hole.
Also a wrist strap is supposed to have a large series resistor built in to protect you in case it does connect to something energized. Make sure it has the resistor.
Finally, check that your outlet is wired correctly. If not, ground might not be where you think it is.
Lastly, you can ground to other things like a metal water pipe with much less risk.
Also see this question and answer.
Is it a bad idea to plug the other end of ESD strap to wall ground?