In this case, we can tell that the sentence is in passive voice because "killed" is not usually used as an adjective. Both of the meanings you give would be considered uses of the passive voice, rather than a stative use of "were".
- 5 people were killed/injured (by gunman yesterday.) (Passive)
- 5 people were killed/injured (in yesterday’s incident.) (Passive, with the agent left out)
It's still considered the passive voice even when the agent is vague or unknown. In fact, this is one of the reasons the passive voice is used: if the cause of the people's death is unknown, we can use the passive voice to avoid having to describe the agent.
In other cases, it might not be clear even to a native speaker:
'The door was closed yesterday" can be either a passive voice sentence in past simple saying that "Someone closed the door yesterday", or it can be a sentence in past tense stative saying "the door was in the state of being closed yesterday". This is because "closed" can be either an adjective, or a past participle of the verb "to close". There is no way to tell which one it is just from the sentence; you would need to use the context to figure out which meaning is right.