There were several degrees of stun settings available on Federation phasers. Effects could range from slight disorientation to unconsciousness and serious injury.
Along with hand weapons, shipboard phaser banks could be modified to deliver a potent stunning beam. This could be useful in incapacitating large crowds from orbit, but was seldom used. (TOS: "A Piece of the Action")
A weapon fired on stun would not usually set off internal alarms on Federation starships, as lethal power settings would. However, a stun setting applied at close range to the brain could kill a target. (Star Trek VI: The Undiscovered Country) Multiple stun attacks in a short period of time could begin to damage a target's central nervous system. (TNG: "Samaritan Snare")