I find these 2 verses a bit confusing. Hanumān says these to Rāvaṇa in Sundara kāṇḍa of Rāmāyaṇa. What is Hanumān or Vālmiki trying to tell here?

In verse 28 he says one's dhārmic acts do not nullify adhārmic acts. But then he also says "Righteousness in abundance destroys unrighteousness"

Verse 29 seems very clear though. It suggests the results of dharma (puṇya) and adharma (pāpa) go into separate baskets -- so the results of one do not affect the other, they need to be experienced independent of the other.

How to make sense of all this?

If it helps, you can find 3 commentaries on these 2 verses here:




न तु धर्म उपसम्हारम् अधर्म फल सम्हितम् || ५-५१-२८
तत् एव फलम् अन्वेति धर्मः च अधर्म नाशनः |

na tu dharma upasamhāram adharma phala samhitam || 5-51-28
tat eva phalam anveti dharmaḥ ca adharma nāśanaḥ |
28. dharmopasamhaaram = the fruit of righteousness; na tu = is not; adharmaphalasamhitam = close by the result of unrighteousness; tat phalameva = that consequence of unrighteousness alone; anveti = follows as an adherent; dharmashcha = righteousness; adharma naashanaH = destroys unrighteousness.
"The fruit of righteousness does not exist together with the result of unrighteousness (even though he practices virtue). That consequence of unrighteousness alone follows him. Righteousness in abundance destroys unrighteousness."

प्राप्तम् धर्म फलम् तावत् भवता न अत्र संशयः || ५-५१-२९
फलम् अस्य अपि अधर्मस्य क्षिप्रम् एव प्रपत्स्यसे |

prāptam dharma phalam tāvat bhavatā na atra saṃśayaḥ || 5-51-29
phalam asya api adharmasya kṣipram eva prapatsyase |
29. dharmaphalam = the fruit of virtue; praaptam taavat = has already been obtained; bhavataa = by you; na samshayah = there is no doubt; atra = about it; prapatsyase = you will obtain; kSiprameva = just soon; phalamapi = even the fruit; adharmasya = of unrighteousness also."
"You already obtained the fruit of virtue till now. There is no doubt about it. In no time, you will obtain the fruit of unrighteousness also."