My daughter was having problems with her (relatively) new Samsung A40 Android phone. It was failing to retain a charge. She would plug it in overnight and the next morning the charge would drop.
In the last few days the problem was getting worse.
Initially we thought it might be the charger, but using different chargers had no discernible impact.
We thought we might need to take it back or send it off.
However in the end my wife came up with the solution, which was a typical IT solution, turn it off and back on again. Very soon the charge was back up to 100%.
Not sure of the cause, it may have been a malfunctioning app, or an issue with the operating system. I will need to keep an eye on it.