It is generally recommended that a second generation Apple Pencil should be kept docked with the iPad whenever it is not being actively used - as this will ensure that the tiny internal battery is kept optimally charged. Charging only occurs 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