This book provides a complete exposition of equidistribution and counting problems weighted by a potential function of common perpendicular geodesics in negatively curved manifolds and simplicial trees. Avoiding any compactness assumptions, the authors extend the theory of Patterson-Sullivan, Bowen-Margulis and Oh-Shah (skinning) measures to CAT(-1) spaces with potentials. The work presents a proof for the equidistribution of equidistant hypersurfaces to Gibbs measures, and the equidistribution of common perpendicular arcs between, for instance, closed geodesics. Using tools from ergodic theory (including coding by topological Markov shifts, and an appendix by Buzzi that relates weak Gibbs measures and equilibrium states for them), the authors further prove the variational principle and rate of mixing for the geodesic flow on metric and simplicial trees—again without the need for any compactness or torsionfree assumptions. In a series of applications, using the Bruhat-Tits trees over non-Archimedean local fields, the authors subsequently prove further important results: the Mertens formula and the equidistribution of Farey fractions in function fields, the equidistribution of quadratic irrationals over function fields in their completions, and asymptotic counting results of the representations by quadratic norm forms. One of the book's main benefits is that the authors provide explicit error terms throughout. Given its scope, it will be of interest to graduate students and researchers in a wide range of fields, for instance ergodic theory, dynamical systems, geometric group theory, discrete subgroups of locally compact groups, and the arithmetic of function fields.