If you put your Switch in the dock, it will be charged to 100% constantly.
Lithium batteries don't like to be kept at 100% charge for long periods.
The best charge is somewhere around 80% but the Switch doesn't have a feature to do that for you automatically.
The Switch 2 does have such an option.
Letting the Switch slowly discharge in sleep mode and then charging it back up when you hit 20~30% would be better for your battery life.
Lithium batteries do degrade significantly faster after +600 cycles though.
Not much you can do about that because that is just how lithium batteries work.
In the past there was a homebrew app that could limit charging but they pulled that feature for some reason during an update.
Can't recall which app that was.