Yes, the logic board can be switched. However, that board essentially is the phone - they aren't often sold on their own! You'd generally be salvaging one from another 5 which has suffered severe damage to its external structure.
On the other hand, if the donor handset merely had eg a broken screen, it'd be easier to transplant your current phone's screen into that instead of switching logic boards.