Our Lord warns against looking
lustfully, thereby making a distinction between sinful glances and innocent glances.
“Bold [daring] looks are forbidden, because they lead to sin, just as a parent forbids his child to play with edged tools.” (‘The Catechism Explained’, 1899, p. 393)
“Lust is disordered desire for or inordinate enjoyment of sexual pleasure. Sexual pleasure is morally disordered when sought for itself, isolated from its procreative and unitive purposes.” (# 2391, ‘Catechism of the Catholic Church’)
If we are honest with ourselves and with God, it is easy enough to make the distinction. My general rule is to not stare at women’s bodies. Like St. Therese, I like to look at people on occasion

When asked by a Sister why she was looking so intently at her, St. Therese answered: “No, I just love looking at you!”
Try to be childlike. If you are tempted, look away. Try to see others’ beauty as a dim reflection of the Uncreated Beauty. It is also commendable to - at least sometimes - sacrifice looking at those we find attractive.
"… the smallest acts suffice [to save souls]: a step taken, a straw picked up,
a glance restrained, a service rendered, a cordial smile… all these offered to Love are in reality of great profit to souls and draw down floods of grace on them”
- Jesus to Sr. Josefa Menendez
“Souls are not saved if nothing is done for them. I died on the Cross to save them—I ask of thee no great thing—only a word withheld, a look repressed, a pleasant thought banished, in a word all that restrains and mortifies nature. These little things, united to My infinite merits, acquire a great value."
- Jesus to Sr. Benigna Consolata
In moments of temptation or uncertainty, invoke the intercession of Mary e.g. with the aspiration: “Sorrowful and Immaculate Heart of Mary, pray for us.” St. Alphonsus assures us that those who call on Mary during temptation can be certain that they did not yield to the temptation. (He assumes good-will on our part, of course).