Many times when I'm building weapons on the crafting table, they glitch and get stuck in the walls.
There is 2 ways to fix this that I know of:
Vigorously shake your mouse while holding the object,
Rotate the object out of the wall. (Neither of these work 100% tho)