How can you tell if someone is really hearing the voice of God or if they are suffering mental illness?
A key element in this discernment is the freedom of the ones who are hearing the voice or voices. If they are not open to the possibility that they are mistaken, or at least that their own imagination or memory are at work along with their emotions, then it is likely some mental disorder or condition is at work. Resistance to other explanations is a sign that the person is not interiorly free to consider his or her actions with openness.
The matter is even more serious if the person begins to view anyone who questions his experiences as a personal enemy or an enemy of God. Christ and his Mother and the saints really do speak sometimes in distinct words to some persons, but if the person's experience is authentic and not pathological, then he will be open to questions about his experience and may admit that it might be reasonable to doubt it. St. Faustina, for example, was told by Our Lord to follow her confessor's advice if it were different from the Lord's! So there was a sign of a healthy experience of God's gifts.
Spiritual directors regularly tell souls who have these experiences to ignore them or ask God to remove them. Lack of inner freedom and anxious attachment, then, would be signs the experience was not a healthy one. If God really wills to make use of these less ordinary means, then he will have his way in spite of anyone's judgment, so we do not need to push or insist that other's believe us. If we do so, then we are to some greater or lesser degree unhealthy spiritually.