I would use a centimetre.
Centimeters/inchesThe most appropriate metric unit for the purpose of measuring the length of a pencil would be centimetres.
Centimetres or millimetres (for precision).
You could use either centimeters or millimeters, but probably centimeters.
An average pencil when new would be around 15 centimetres long.
We can easliy measure the lenght of a pencil using a ruler.
Any metric unit would do. But it might be easier to pick something smaller than the length of the pencil, like a centimeter, or a millimeter.