Two-BFS is simpler and cleaner for the basic diameter problem. If the problem asks for diameter, use two-BFS.
DP shines when the problem needs more information: diameter endpoints, all nodes' farthest distances, or combining diameter with other tree properties. DP naturally tracks these during traversal.
For competitive programming, learn both. Two-BFS is faster to code under time pressure. DP is more flexible for complex problems. Choose based on what the problem requires beyond the diameter value.