Yes. Unlocking your bootloader will void the warranty on your phone, even if your manufacturer provides a way for you to do it.
That said, if you need warranty service for a hardware issue, you can sometimes unroot your phone and take it in for service with no one the wiser.
However, some phones have a digital “switch” that flips when you unlock your phone that is very difficult or impossible to revert, so do your research before unlocking if you want to preserve your warranty.
Could rooting brick my phone?
It’s possible, but pretty unlikely.
As long as you follow instructions well, you probably won’t brick anything (but we’re not responsible hehe hehe hehe).
Flashing custom kernels and radios is a little riskier than just rooting or flashing ROMs, but again if you follow directions you should be okay.
Keep in mind that bricking means your phone means it won’t turn on or function at all-if you’re stuck in a boot loop or boot straight to recovery, your phone is not bricked, and it can be fixed.