CBP provide the following advice for visa waiver nationals who enter on electronic I-94 forms and exit by land.
Also, some land border departures may not be recorded in CBP systems. Land border departures on the Southern Border are not always documented. A departure will be recorded if you depart via land and re-enter the United States prior to the expiration date stamped in your passport. If you are not a resident of Canada or Mexico and you receive an electronic I-94 and depart via land, but do not re-enter the United States prior to the expiration date stamped on your passport, you may want to travel with evidence of your departure into Canada or Mexico. Evidence of departure can include, but is not limited to, foreign entry stamps in a passport, transportation tickets, pay stubs and/or other receipts.
If the anomaly can be easily explained, and the visitor is low risk, CBP will correct the record when the visitor is next admitted. The Mexican entry stamp will be useful in proving exit. Alternatively proof of onward travel out of North America should be sufficient.
In my personal experience of exiting into Canada on foot I got a more thorough questioning than usual when re-entering the USA but CBP seemed satisfied within a minute or two that I was not a bad guy.
The quoted text is from https://i94.cbp.dhs.gov/I94/history.html, where your current I-94 status and history can also be checked. You may have to log in with your passport and click on the FAQ tab to see the text I quoted.
Credit:stackoverflow.com‘