If the laptop is plugged in, then it's perfectly fine to use the laptop. However, if the laptop is plugged in, then the excess power supplied by the wall socket is left unused and drains your batteries to a point where you will be able to use your laptop for just a few minutes before it runs out of power. Therefore, the best practice is to unplug your laptop when it's not in use.