Divorces are of two types: explicit and implicit. Explicit divorce is the word of divorce (talaaq) and phrased derived from it, such as saying taaliq (you are divorced) or tallaqtuki (I divorce you).
Implicit divorce means phrases such as: Go back to your family, or I don't want you, or I have no need of you, or Allaah has relieved you of me.
In the first case (explicit divorce), divorce takes place even if that was not the intention.
With regard to the second case, which is implicit divorce, according to the majority of Hanafis, Shaafa’is and Hanbalis, no divorce takes place unless there was the intention of divorce or circumstantial evidence to that effect, such as a state of anger or an argument, or the wife asked for divorce. In that case divorce takes place even if that was not the intention. Taking the circumstantial evidence into account in this case is the view of the Hanafis and Hanbalis.
See al-Mawsoo’ah al-Fiqhiyyah, 29/26
If a person is uncertain as to whether he intended divorce or not, then no divorce has taken place, because the basic principle is that there is no divorce.
If a person is affected by waswasah with regard to what he says or believes, he will not be brought to account for any of that with regard to divorce or anything else, such as a person who is uncertain as to whether he has divorced his wife or he thinks that if he says a specific word or thinks about a specific idea, his wife will be divorced -- his wife is not divorced.
And Allaah knows best.