I've noticed a strange problem with my 2018 MacBook Pro. Sometimes, when I use it with the (original) adapter, it says that the power source is power adapter, but the battery is still draining and not charging:
This is a huge problem as the level of charge can become very low before I even notice it. Also, I'm not doing any resource-intensive work. As an experiment I left it running and observed the charge get down to 40% before I disconnect the cable and reconnect so the charging would start.
What may be causing this issue?