One way to choose between two legal candidate moves would be to look forward for the next move by the candidate pieces and see which ones make sense given. If you are trying to choose between e6 and e5, for instance, look forward and see what the next e pawn move is. Plenty of other ways to go about this, of course.
Wouldn't other pieces affect this though? For example, what if the move was e6 and the next e-pawn move was e7. What if a piece was already there, Ne7 (wrongly recognized)? I thought about slowly running through it like this, but it felt like I kept running into problems which are obvious for us to recognize but I wasn't sure how to implement it computationally