Think of locators as addresses. A good address: "123 Main Street, Apt 4B" — gets you exactly where you need to go, every time. A bad address: "the third building on the left after the blue sign" — works today, breaks tomorrow when someone paints the sign red.
Same with locators. By.id("userId") is like a street address — direct, reliable. By.xpath("/html/body/div[3]/div/form/div[1]/input") is like saying "go down the third hallway, turn left, second door" — any change to the building layout breaks it.
The #1 cause of flaky tests in the industry is fragile locators. Invest 2 extra minutes writing a good locator. It saves 2 hours of debugging later.
Key Point: A good locator is unique, stable, readable, and short. It survives UI changes without breaking your tests.