Earplugs or a sound machine for a noisy bedroom?
The choice depends on the sound you want less of and the sounds you still need to hear.

Listen long enough to name the problem
Occasional voices in a hallway present a different bedtime problem from a fan that runs all night. A sound machine adds a steady sound that can make interruptions less distinct. Earplugs reduce what reaches the wearer without adding sound to the room. Decide which trade-off seems welcome before comparing machines with thirty varieties of rain.
Start with a reversible trial
Use a sound you already have, such as a fan or a short recording, to see whether a low, steady backdrop feels helpful. If you try earplugs, follow the package instructions and notice how they feel on your side. A shallow profile may matter more than elaborate packaging if your pillow presses against your ear.
Keep the sounds that matter
Check, while awake, whether you can still hear the alarm, doorbell, or other household signals you count on. Keep the sound machine at a low comfortable volume, away from your pillow. If you share the bedroom, ask how it sounds from the other side before giving the device a permanent address.