If you are manually assembling them, you could put a layer of kapton tape underneath to discourage shorts. That's what I do with my product which I hand-assemble using a castellated module. I think shorts are unlikely as 2 layers of solder mask (plus the height of silkscreen etc) will be enough to create a little gap.
Is there any reason to treat the swd / debug pins differently from the others? On the Pi Pico, as far as I can see, every pin has both a throughhole and a castellation on the board edge, including the debug pins - you can just put pads on the main board and solder them in the usual way, then add throughholes on your main board if desired.
On the other hand, if you're not likely to need the swd pins on a specific board, you could route-out a slot underneath them to allow for optional installation of pin headers directly on the Pico, and leave them unconnected when not needed.