phylogenetic trees built from DNA/protein sequences use sequence differences between these biological sequences as proxies for relatedness.
More specifically, maximum-likelihood phylogenetic trees (which are arguably the most commonly used/most accurate way to build phylogenetic trees) assume an evolutionary model (i.e. a way in which sequences diverge) and try to learn parameters that best explain the sequence divergence we see in our DNA/protein sequences.
In my mind, everything is clear and straight forward if you assume neutral evolution and constant mutation rates. Under this model, sequences will simply randomly mutate at a constant rate, and the more different two sequences are, the more distantly related they will be (on average, at least).
Now, what happens if we assume non-neutral, i.e. positive or negative selection? Can maximum-likelihood trees detect this? How do they handle this? Can they? Should we even build phylogenetic trees on sequences that evolve non-neutrally? I cannot wrap my head around