Toph's ability to detect lies in Avatar: The Last Airbender proved useful more than once. The blind Earthbender learned to "see" by sensing the vibrations in the ground around her, honing her senses finely enough to detect deceit in those who lied to her. This power was invaluable to the Gaang during their adventures, and Azula was only able to fool the Earthbender thanks to her exceptional ability to lie.
Except, Azula was not the only liar to succeed. Multiple people lie without Toph detecting their deceit throughout The Last Airbender, offering new insights into just how her ability to detect lies worked.
Toph's unique senses were a boon to herself and her friends throughout Avatar. After gaining her seismic sense while learning to earthbend from the badgermoles, Toph's abilities expanded to a keen 360-degree view of the world around her. These senses alerted her to approaching threats like Azula or Combustion Man, detected the hidden Western Air Temple and Hama's trapped prisoners, and even discovered deceit by picking up on the irregularities that occur in a liar's body. The latter ability was particularly useful when confirming that Zuko's offer to join the Gaang was genuine, or that Jet was brainwashed by the Dai Li.
Yet the brainwashing represents limits to Toph's ability that quickly multiply when looking over The Last Airbender with a critical eye. At times her lie detection's drawbacks are made explicit, such as the Dai Li's brainwashing making its subjects believe what they are saying is true, so they escape Toph's notice. Another major exception was Azula actively resisting Toph's attempts to read her in the Day of Black Sun, meant to stand out as a display of Azula's exceptional self-control and ability to lie flawlessly. Except there are other instances where Toph's failure to detect lies indicate even further limitations on her abilities.
Perhaps one of the most notable moments occurs with a character known as Old Sweepy, an undercover Dai Li agent who falsely informed the Gaang that Appa was moved to Whaletail Island when the sky bison was in fact imprisoned beneath Lake Laogai. Another time came when Aang assured Toph he'd mastered the Avatar State when he actually ended his training with Guru Pathik prematurely.
A further instance of deceit appeared in the episode "The Painted Lady," where Katara dishonestly convinced the rest of the Gaang that Appa was sick in order to remain in Jang Hui long enough to help the local population. Even when they did not explicitly lie, one would expect Toph's senses to detect some level of deceit in both Long Feng and Hama when the false charms of both concealed sinister intentions.
The easy solution to such inconsistencies would be to assume they were oversights on the creators' part, but Avatar pays far too much attention to its details for that to necessarily be the case. Instead, there is a perfectly legitimate in-universe reason for Toph to fail to see deceit on the above locations: the ability to detect lies is not passive, and instead needs to be activated. It's notable that during the ability's introduction in "Lake Laogai," Toph places her hand directly on stone while making a concerted effort to tell the truth. While she detects lies elsewhere without the need to make contact, the detail is an indication that it requires "listening" a bit more closely than Toph does by default.
In all the occasions in The Last Airbender where Toph failed to notice someone lying, it would be understandable that she simply had her guard down and had no reason to suspect duplicity. Old Sweepy, Aang, Katara and even Long Feng and Hama were all seemingly trustworthy and benevolent individuals at first.
The interpretation of Toph's lie detection as an active ability rather than a passive one also restores the impressiveness of Azula's ability to deceive. That is one of the few instances where Toph made an active effort to gauge the honesty of someone and admitted she was unable to do so. Unlike all the other occasions, that one was not simply Toph failing to pay attention. Yet again the subtle details of Avatar: The Last Airbender reward those who look for them, and much like Toph, fans need only listen closely to find the truth.