Comparison of various strategies
Office test: Blocking keyboard and mouse noise is minimal better with "Sony WH-1000XM5" than the in-ear ANC buds "Galaxy Buds 2". Both can block distant voices equally. The Sonys can reduce the volume of nearby voices. If I combine them with sound masking sound, I don't hear the nearby voices. The passive noise reduction and the ANC of the Sonys allow playing the sound masking sound at a lower volume. "Ear muffs + ANC ear buds + sound masking sound" combo is very similar regarding voice blocking.
(Final) Public transport test: The "Sony WH-1000XM5 (with nothing under them) + music" combo offers a similar protection like "ear muffs + ANC ear buds + music from buds" combo.
Car and loud music from speakers of the car, two people talking in front of me:
About 1 year ago, I tested the "ear muffs + wired in-ear headphones + music from in-ear headphones". It was enough to block out the other music and the conversation.
Conclusion and additional advice
ANC is not necessary but can help to reduce the volume of music. But if you have a very good passive noise reduction, the effect is very similar. Reducing the volume of the music is better for your ears in the long run.
Ear muffs cost a lot less than ANC headphones, offer a very good passive noise reduction but are not very comfortable (high clamping force). You can increase the comfort by wearing a ball cap under them, however the ear muffs can be a bit less protective by doing this. Furthermore, it's possible to combine the ear muffs with earplugs to increase their protectiveness. If you want music, you can either use ear buds or wired in-ear headphones (I didn't notice a loss of protection through the cable). There are models with built-in speakers but it's not sure if they are loud enough and/or have a good sound quality. Save your money by buying normal ear muffs and combine them with ear buds or wired in-ear headphones.
Combine your device with music to increase the effectiveness of noise blocking/reduction. If you need to concentrate, choose sound masking sound instead. Feel free to use my
playlist with sound masking videos (it now can be seen by all users and not only by those who have the link

). If you don't have mobile internet available, use a white noise generator app like
myNoise. Masking speech: "The important speech frequency bands are 500, 1000, 2000, and 4000 Hz" according to
this guide.
Noise from neighbors: Play a sound masking video in the background. Start low and increase the volume step by step until you don't hear the noise from your neighbors anymore or it's bearable enough. If the noise from the neighbors is still too loud, combine the sound masking video with headphones, earplugs, and/or ear-muffs - keep the video playing in the background or hear it with your headphones.
You can increase the effectiveness by playing multiple sound masking videos at once. If you want sound masking in every room, use your available devices: tablets, phones, TV, etc.
But be aware: If you play the video very loud (so the neighbors can hear it) and long enough (like I did unintentionally while I'm writing this post), they will react to it - I just heard a single thud and turned the volume of the sound masking video down. I achieved what I wanted nevertheless: no loud music from them right now.
Useful resources
Finding the right ANC heaphones for your budget:
https://www.soundguys.com/best-noise-ca ... ones-5220/
Blocking voices:
https://noisyworld.org/noise-cancelling ... es-voices/
Crying babies:
https://noisyworld.org/block-out-baby-crying-sounds/