“Don't make bad friends. Don't hang out with lowly people. Make good friends. Interact with precious people.”
(Translated by Nakamura Hajime, “Buddha's Words of Truth: Words of Inspiration” by Iwanami Bunko)
I think you're probably referring to these words.
Let me digress for a moment before I reply.
The sutras called the Dharmapada, and Suttanipata are one of the oldest categories handed down to the present day, and they are known by listening to the direct explanation of early Buddhism, the Buddha.
However, I think you know that Buddha did not write a book with a brush, but that part of it was transmitted through editing and translation by his disciples who listened to the sermon, and what was translated into Japanese in recent years (the same book by Nakamura Hajime and others) is now touching our eyes.
In other words, it is not limited to the words of Gautama = Buddha of the Shaka tribe. Buddha, that person is Buddha (the awakened person), but Buddha is not alone in history. There must have been a disciple, Buddha, whose name has not been passed down to the present day. Since it is based on these words, the above are not “Buddha's” but “Buddha's words.”
Also, it is based on the commandment called the “Ten Good Commandments,” which is the teachings of Shingon Esoteric Buddhism monks in the Edo period. This is not to say that it is a mistake, and when interpreting Buddha's words, it is likely to be confusing when arranging stories with quite different historical backgrounds.
(Jiun Shonin, who was called the Ten Good Commandments, may have studied the Dharma Sutra as well.)
====
Now, on to the question about the criteria for judging good people and bad people.
If I had to say, I really think “it's right to be lost in judgment.”
How horrible is it to judge good people and bad people with my imperfect “yardstick.”
Also, there are the following words in the verse of “Dhammapada.”
“There is nothing to be afraid of for people whose hearts are not tainted by worries, their feelings are not disturbed, who abandon the line between right and wrong, and are awake.”
So, I think it's okay to be afraid of getting lost. Rather than being able to take it for granted that getting lost is normal.
I consider people who acknowledge such “weakness of heart” and make us aware of them as good people. At the same time, I think that everyone has that element, even a bad person who makes me proud, judges and selects people, and cuts himself up.
Good and evil live together in me, and good and evil live together in people I love, people I respect, people who commit crimes, and people who are lazy