Batteries do get warm when charging, unfortunately they can also fail early. If the battery is still under warranty I suggest you contact the supplier and explain the symptoms. If not then there are tests you can try such as those shown here. I don't use a laptop and have no experience of the tests provided, but there are others who may have used them - if so hopefully they will give their advice.
OnePlus 5 review