These batteries will loose their total capacity over time. Only charging the battery to 80% of max charge, and never allowing the battery to fully discharge will help extend the battery's capacity. It is better for overall battery life to charge it more often, but for smaller amounts, that it is to charge for longer periods of time, but less often. In other words, going from 100% to 20% and charging back to 100% takes more life out of the battery than going from 80% down to 40% charging back to 80% and running it back down to 40% and charging it back to 80%. Effectively both scenarios "used" 80% of the batteries capacity, but it is better for the battery to do that in two 40% segments than a single 80% segment. Even better would be eight 10% segments (from 80% to 70% and recharge to 80% repeated eight times).
Some will argue that if you replace your phone every couple of years, the amount of capacity lost isn't worth the hassle and worry. I tend to disagree and try to only charge my phone to 80% unless I know my day is going to be long without access to a charger and want the extra life of a fully charged battery.
I use to root my Android phone and used a program that would literally shut off the charging at 80%. This was the best solution because it meant that while the phone was plugged in, but at 80% capacity, the battery was effectively disconnected from the charging circuit and the phone was being 100% powered by the plug. This helps extend the life of the battery even longer and does away with any long term effects of keeping the phone plugged in.
I have not rooted my latest phone (a Pixel 6 which I've had almost a year now), so I have to use a non-root app for this. It cannot change the charging characteristics without root, so it is basically a notification app only. The phone vibrates and notifies me when the charge gets to 80% (and every couple of minutes after that), but I have to physically remove the phone from the charge or it will continue to charge up to 100%. While I do try to remove the phone from the charger at 80%, I don't loose any sleep over it if I cannot.