I recently wanted to build a XP farm and started to watch YouTube until I found this YouTube video Link RemovedLet me know If it's good!
(I know it says 1.16 but it still works right?)
If you build the farm with magma blocks for the pigmen to spawn on, then you should be good to go. Also, you should check out Shulkercraft for survival tutorials because they have a bunch of gold farms. Good luck!