I’d do something along these lines:
Vector3 delta = newPosition - oldPosition;
delta.y = 0; // If you specifically want to ignore the y-axis
if (delta.sqrMagnitude > threshold)
{
// Moved by more than the square root of threshold
}
(Checking the sqrMagnitude is more efficient than checking the actual magnitude, because computing the actual magnitude involves a square root.)
Your current approach is also pretty close to something that could work, but instead of
offset.x > threshold || offset.x < threshold
you want to check
offset.x > threshold || offset.x < -threshold
or
Mathf.Abs(offset.x) > threshold
Right now, a movement of 0 will meet your condition, because 0 < 1.
Also, Unity automatically does approximate comparisons on vectors, so if you’re OK with using Unity’s default threshold for “approximately”, you can just check
if (newPosition != oldPosition)