Yes testing eggs to see whether they're fresh or no longer fresh using the floating egg test in water is a reliable way of knowing whether an egg is safe to eat or whether an egg is no longer safe to eat and should be thrown out.
Eggs that float to the surface are no longer fresh or good to eat so they should be thrown out to avoid becoming sick.
Eggs that sink to the bottom are still good to eat and are fresh.