In this thesis we study some fine properties of sets in the boundary of continuous and discrete metric spaces. On the discrete side, we consider a Potential Theory on infinite trees. Using probabilistic methods, we derive a description of the set of irregular points for the Dirichlet problem on the tree. In particular, we obtain a Wiener's type test and we show that the set of irregular points has zero capacity. We also discuss some uniqueness results for the solution of the Dirichlet problem in some energy spaces. Then, we provide an equilibrium equation characterizing measures that realize a p–capacity on the natural boundary of the tree and we discuss a quite surprising application to the classical problem of tiling a rectangle with squares. In the continuous setting, we study metric distortion properties of sets in unit circle under the action of inner functions. Classical results by Löowner and by Fernández-Pestana describe this distortion in terms of Lebesgue measure and Hausdorff content respectively, for inner functions having the Denjoy-Wolff point in the unit disc. We present an extended theorem of the same kind which applies also to inner functions with no fixed points in the unit disc. In this situation, the distortion properties are given in terms of a natural (infinite) measure which provides at the same time information on the size and on the distribution of a set around the Denjoy-Wolff point. As an application of our result we derive an estimate of the size of the omitted values of an inner functions in terms of the size of points in the unit circle not admitting a finite angular derivative. Using our result we are also able to prove a version of Löwner and Fernández-Pestana theorems for inner functions of the upper half plane fixing the point at infinity.