There are two primary issues here, carbon and plastics.
I would expect carbon emissions to be higher for ink, but not significantly. Transport/logistics/retail would be similar for both products and likely has higher emissions than manufacturing.
Modern Ink usually includes micro plastics within the ink, and the packaging for a pen refill also has much more plastic. A fountain pen with traditional ink would avoid this issue obviously.
The half life of carbon is 27 years in the atmosphere, and we are actively dealing with the issue. Plastic on the other hand lasts
much longer and is poorly understood (we don't really know the half life for responsibly disposed of plastic - it could be thousands of years).
Therefore, I'd argue pencils are more sustainable. Unless you use a fountain pen with traditional ink.