These USB-C switches (you can find plenty of them on Amazon) will work with UltraFine 5K second gen only (KL-B version) and you only get 4K resolution max.
To get full 5K you need a Thunderbolt 3 KVM switch, but I am not sure about compatibility with Linux systems.