Does this help? https://vaspkit.com/2019/05/21/vaspkit-avgpot/
Also, make sure that when you get the potential that it does NOT include the exchange-correlation part (depending on the Vasp version this is set as default).
Ge Liangbing , Vedanth Iyer , Peter Schindler using vasp kit we get the potential data for plotting. But how do we get finally the work function value?