What do we learn from the verse?
Brachos 5a #1: Afflictions of love are those that do not cause Bitul Torah.
Brachos 5a #2: One who is afflicted is fortunate.
Brachos 5a #3: This teaches that Torah was given through afflictions.
Rashi Fortunate are Tzadikim who are afflicted under Your 1 hands, as long as they engage in Torah and Mitzvos.
Radak: If the Resha'im will say, if you are better than us, and you have good Emunah, why are you so many years in Galus, shame and evil? We tell them that it is for our benefit; You afflict us amidst love.
Malbim: This begins to explain why Tzadikim are afflicted and Resha'im have good. The Rasha's good brings his demise; the Tzadik's afflictions save him from eternal loss.
I do not know why Rashi writes 'Yedeichem' - Your (plural) hands. Even though we find "Elokim Chayim" (Devarim 5:23), here it does not mention 'Elokim'. Everywhere, Rashi uses the singular for Hashem! (PF)
What do we learn from "umi'Torascha Selamdenu"?
Refer to 94:12:1:1, 3-4. Brachos 5a #1: Afflictions of love are those that do not cause Bitul Torah.
Radak: The Torah teaches that the Tzadik's afflictions are for his benefit, amidst love - "Ki Ka'asher Yeyaser Ish Es Bno Hashem Elokecha Meyasreka", "Lema'an Anosecha u'Lema'an Nasosecha Leheitivecha b'Acharisecha" (Devarim 8:5, 16). Also here, the affliction is for your good in the end, lest he have days of evil [in the world to come]. Also, afflictions teach him to return to serve Hashem with a full heart.
Malbim #1: The Torah teaches that the Rasha's good brings his demise - "u'Meshalem l'Son'av El Panav Leha'avido" (Devarim 7:10).
Malbim #2: The Torah teaches that the Tzadik's afflictions save him from eternal loss - "Ki Lo Yitosh Hashem Amo" (verse 14).