Nobody lives a perfect life, everyone of us has those ups and downs. So whenever Allah puts you in difficulty, increase in His remembrance. Read more Quran, talk to Allah, ask Him to advise you, to help you and He will not let you down!
"And certainly, We shall test you with something of fear, hunger, loss of wealth, lives and fruits." [2:155]
Also, every pain that you go through shall come to an end eventually In shaa Allah. Pray for Allah to make it easy for you, keep you steadfast and be grateful for His blessings. If you wanted things to go another way, don't worry, Allah's plan is always better and He is the Best of Planners.
Instead of thinking about your pains, think about the good things in life, Allah's blessings (your family, your health, your friends etc). Focus on the positive and remember that Allah loves you! After all, the one (peace be upon him) most beloved to Allah was the most tested out of all His servants.
Sa’ad bin Abi Waqqas reported that he asked the Messenger of Allah (peace be upon him): “Which of the people are tested most severely?” Rasulullah (peace be upon him) replied: “The Prophets, then the righteous, then those who are most like them, then those who are most like them from the people. A man is tested according to his religious commitment. So, if his religious practice is sound, then his testing is increased, and if his religious practice is weak, then his testing is reduced. A servant continues to be tested until he walks the Earth without a single sin on him.” (Ahmad, Tirmidhi)
A beautiful quote:
“A human being is tested so that he may come to know the reality of himself and others. Life consists of constant testing; testing with what is bad, or testing with what is good. However, what is best for the believer may be found in what he hates, and what is bad for him may be found in what he likes. The true believer is the one who loves that which Allah has chosen for him. So, if He tests him with something that he loves, he thanks Him, and if He tests him with that which he hates, he is patient and thanks Him in this case, as well. And Allah – the Glorified – gives the believer in accordance with what will lead to his happiness in either this World or the next. So, if it is better for him to have something, Allah gives it to him. If it is better for him not to have something, Allah prevents him from having that thing, just as one who is sick is prevented from too much food or water. Therefore, it is upon a person to completely submit to Allah – the Glorified – in regards to what He has chosen for him, and to be pleased with what Allah has given him, and to understand that if Allah prevents him from something, then it is because Allah wishes to save him from being tested with that thing.” (anonymous)