According to this source https://www.yoursolarlink.com/blog/replacing-nicd-rechargeables-with-nimh-rechargeable-batteries-in-solar-lights-the-better-choice/ you can replace the NiCd batteries with NiMH batteries. The lifetime for the NiCd is 2 years which is pretty short and they have a memory effect that can shorten the life even more. Every rechargeable battery deteriorates with time and the number of times you recharge it. I never even thought about it when I bought a bunch of second-hand solar lights for my Christmas display. I replaced all of the batteries with NiMH regardless of what came in the light, NiCd or NiMH. They were out there for about two months with no problems. I bought my batteries from China - BTY brand from Toyofmine an eBay seller. I’m skeptical of the 3000 mAh rating for them but they work fine in solar lights. Price was around 75 cents each, shipping included. Compare that to any that you see in local stores for dollars each.
If you own a NiCd and a NiMH charger, just charge the cells before you first install them. The come charged but maybe not fully charged. NiMH cells lose their charge much slower than NiCd so that is one more reason for using them.