You can’t freely mix shifters and derailleurs between brands, as they use different cable-pull ratios.
However, you can often swap chains and cassettes across brands if the speeds match up.
Just stick to the same drivetrain family for best results.