Exact formulas for two interacting particles and applications in particle systems with duality