Quick answer
Metal gets heated to find out what is actually in it. The verse says God does the equivalent with people, and the point of refining is not destruction.
Read both lines
The image assumes something a reader might resist: that testing is how what is genuine gets separated from what is not, and that this is ordinary metallurgical practice rather than cruelty. A refiner does not heat silver to ruin it. What makes the verse land is the shift in the second line from a process to a person, and from metal to hearts, plural, which is where this book consistently locates the real self. Nothing here says God arranges hardship to test people. It says the interior is not hidden from Him and is not left unexamined.
Related: Proverbs 16:2 · Proverbs 21:2 · Proverbs 15:11
New King James Version®, Copyright © 1982, Thomas Nelson. All rights reserved. Full copyright information. Scripture provided by API.Bible.
Go Deeper
If this verse has been used to put weight on you that it was never carrying, ask about it directly.