This is something that really depends on the person. There’s a lot of factors to consider in your individual approach to something like this.
The main thing to consider is your experience and skill levels. For people new to fitness you may be able to get away with doing both for a while. You can make gains in strength and burn fat for sure, but your fat loss may not come as well as you’d expect while focusing on both goals.
As you progress and gain more experience you will have to change your approach the more advanced you get. It’s better to pick one goal and focus on that one thing a few months at a time, especially the more experience you have with intense training.
As you build muscle, over time you have to adjust your training and eating habits in order to see continued muscle growth. And as you progress, the changes that you’ll need to make will be things that go against what’s needed for your fat loss.
A lot of fitness is a mind game, and having a clear intention and focus on 1 goal at a time will help you be more efficient in reaching your fitness goals.
When aiming for fat loss your approach to your training will be different than your approach to your training for muscle growth. You’ll be working on at lower intensities for higher reps than you would be for your muscle gains.
On top of that, it just takes time for your body to adapt to those changes in your training. Which is why you’d want to spend a few months at a time working on one thing.
There are also changes that would need to be made in your diet and how you fuel your body for muscle growth vs fat loss. More advanced lifters may need to consume more calories as for muscle growth as time goes on to see continued muscle growth. This is important for making sure the body has what it needs for repairing and building muscle tissue.
Overall, it’s just better to pick one thing and go hard at it for a while before going on to the next thing. It may be hard to do both at the same time but experience in one area will definitely help you go after the other.