Not necessarily, it’s possible to both lose weight and build muscle at the same time with the right nutrition and exercise routine.
The worst thing you can do in this case is significantly cut back on your caloric intake, since this is what will have the muscle on your body deteriorate quicker than anything else.
Instead, you need to strike a balance between calories consumed and the amount of exercise done, so you can make progress towards both goals.