Introduced in 1947, the Wiener index $W(T)=\sum_{\{u,v\}\subseteq V(T)}d(u,v)$ is one of the most thoroughly studied chemical indices. The extremal structures (in particular, trees with various constraints) that maximize or minimize the Wiener index have been extensively investigated. The Harary index $H(T)=\sum_{\{u,v\}\subseteq V(T)}{1\over d(u,v)'}$, introduced in 1993, can be considered as the “reciprocal analogue” of the Wiener index. From recent studies, it is known that the extremal structures of the Harary index and the Wiener index coincide in many instances, i.e., the graphs that maximize the Wiener index minimize the Harary index and vice versa. In this note we provide some general statements regarding functions of distances of a tree, from which some of the extremal structures with respect to the Harary index (and a generalized version of it) are characterized. Among the results a recent conjecture of Ili\'c, Yu and Feng is proven. A case when the extremal structures of these two indices differ is also provided. Finally, we derive some previously known extremal results as immediate corollaries.