Hi Chirag,
Regarding .mldist: Please note that this is not the distance matrix computed from the tree. Instead this is the distance from pairwise sequence comparisons, i.e. just by looking at sequence content — no tree is involved here. The distance is computed using maximum likelihood (that’s why it’s called mldist) based on model parameter estimates from an initial tree. The main purpose of IQ-TREE was to use this distance matrix to build a neighbour-joining tree, which is used as one of the starting trees for more thorough ML tree search.
For the 2nd question, if you want to use a tree to compute the distance (i.e. the path lengths between 2 species), I guess you can use some R package such as APE, though I haven’t use it myself. This should work regardless of rooted or unrooted trees.
Any finally since you mentioned HGT: since this is non-treelike event, you should use some phylogenetic networks such as those implemented in the SplitsTree software.
Hope that helps,
Minh