I just unscrewed my laptop because a part inside has come loose and the laptop kept making noises when I moved, but since I'm not familiar with it, I wanted to ask whether this is simply a part that has broken off the case or something important
lol
If the part is not made entirely of plastic (housing part) but has a metal edge at the top and bottom, it is probably an SMD capacitor.
If the laptop is still running now… Then it fits. If it was a capacitor, then it was probably used to suppress interference… Which is no longer quite there; but if the box is still running, then leave it!