It is generally recommended that a second generation Apple Pencil should be kept docked with the iPad when not in use - as this ensures that the tiny internal battery is kept optimally charged when not in use. Charging only occur when the battery requires charge from the iPad, optimal charge being entirely automatic.
Keeping the Pencil separated from the iPad when unused risks allowing its battery to discharge; if allowed to remain in this state, the battery will suffer irreparable damage. When the battery fails, the only remedy is to replace the entire Pencil; the battery is not a serviceable item.
An otherwise healthy Apple Pencil will suffer no negative consequences from being docked with its host iPad for extended periods.
Charge your Apple Pencil and check the battery - Apple Support