If you play the ♥5 to one of Dummy's Honour cards first, then return to your ♥Q you will be cut off from Dummy, unable to cash the remaining three heart winners.
Play the ♥Q from Declarer's hand first, then cross over with Declarer's ♥5 to Dummy. Dummy wins the trick and can now run off all remaining heart winners.
Here are two more typical card combinations :
♦ A Q J
3 5 9 10 K ♦
Play the ♦A and ♦Q in Declarer's hand first.
Then lead the ♦J and take it over with Dummy's ♦K.
Dummy now has the lead and can play out the two remaining diamond winners.
♦ A Q
♣ 8 4 2
3 5 J K ♦
Here you must still play the High cards from the short side, but if you take over Declarer's ♦Q with Dummy's ♦K you will only make 3 diamond tricks in total.
In this case you must "unblock" the diamond suit first, playing Declarer's ♦A and ♦Q (while playing low in Dummy), then cross over to Dummy with a small club to Dummy's ♣A.
Then you can lead Dummys remaining two heart winners (discarding clubs in Declarer's hand).