Rust in particular with miri is quite impressive at catching them. You just run your testcases via
cargo miri run
And if your code actually touches UB, mirei will most likely point out exactly where and why.