Sting was used as a sword by Bilbo, who found it in a troll-hoard together with Glamdring and Orcrist. Although it was just a dagger by the standard of Men or Elves, it made an excellent sword for a Hobbit. Bilbo gives Sting to Frodo, just before the Fellowship of the Ring sets off from Rivendell.
It has the magic ability to detect any Orc presence near it. When this presence is felt, it glows blue, as it does when the Fellowship encounters Orcs in the mines of Moria.
Gollum, who similarly dislikes anything made by Elves, is afraid of Sting. This fear helped Bilbo when confronting Gollum under the mountain in The Hobbit. It also helps Frodo to tame Gollum (temporarily) in The Lord of the Rings.