A somatic mutation can be transmitted throughout the cell line originating from the cell that underwent the mutation, but is not heritable unless it also occurs in germline cells. On the other hand, natural selection as the main evolutionary force acts uppon phenotypic and heritable traits. This means that even if a somatic mutation leads to an increase in the fitness of the organism carrying it, it cannot affect the population as the favorable trait cannot be inherited in the offspring.
Nevertheless, in carcinogenesis, a disease due to, among other things, an accumulation of mutations, there is a correlation of these somatic mutations with natural selection. This is why, during the prevalence of some environmental pressure on cancer cells (anticancer treatment), some cancer cells will acquire the evolutionary advantage of resistance to the medicinal substance. So, this leads to a reduction in cancer volume for a short time after the anticancer treatment is given, then it comes back more robust as the cells that survived were favored by natural selection.