The only unforgivable sin is listed in Scripture (Mark 3:28-30) as “blasphemy against the Holy Spirit” which is usually interpreted as the rejection of God and His love.
Only God knows the state of mind of the suicidal person at the moment of his or her death. It’s entirely possible that a suicidal person is mentally ill or mentally disturbed to the point of being unable to form the necessary intent to commit a mortal sin. Many suicidal people also have some kind of alcohol or drugs (prescription or illegal) in their system that affect their judgment.
People can also repent in the last seconds before death. St. John Vianney, who could read hearts, had a private revelation that a man who had jumped from a bridge repented in the last seconds as he was falling. I had a friend who jumped into a river when suicidal (and drunk) and was last seen caling for help - obviously at that point he had decided he didn’t want to die after all, or else why would he call for help? Some people also believe that God gives people one last chance to repent after death, although we have no way of knowing for sure if God does this.
As for “taking their minds off thinking about suicide”, someone contemplating suicide should get professional mental health help. It is not something where a friend can just “take their mind off it”. Some of us who contemplate suicide are fortunate or strong and manage to change our own thinking without seeing a doctor (I did) but I don’t recommend that. Get the person to a doctor or a counselor or have them call the suicide hotline.