Mutualisms between species play an important role in ecosystem function and stability. However, in some environments, the competitive aspects of an interaction may dominate the mutualistic aspects. Although these transitions could have far-reaching implications, it has been difficult to study the causes and consequences of this mutualistic-competitive transition in experimentally tractable systems. Here, we study a microbial cross-feeding mutualism in which each yeast strain supplies an essential amino acid for its partner strain. We find that, depending upon the amount of freely available amino acid in the environment, this pair of strains can exhibit an obligatory mutualism, facultative mutualism, competition, parasitism, competitive exclusion, or failed mutualism leading to extinction of the population. A simple model capturing the essential features of this interaction explains how resource availability modulates the interaction and predicts that changes in the dynamics of the mutualism in deteriorating environments can provide advance warning that collapse of the mutualism is imminent. We confirm this prediction experimentally by showing that, in the high nutrient competitive regime, the strains rapidly reach a common carrying capacity before slowly reaching the equilibrium ratio between the strains. However, in the low nutrient regime, before collapse of the obligate mutualism, we find that the ratio rapidly reaches its equilibrium and it is the total abundance that is slow to reach equilibrium. Our results provide a general framework for how mutualisms may transition between qualitatively different regimes of interaction in response to changes in nutrient availability in the environment.