The United Nations and the United States appealed for restraint on Thursday after Iran and Pakistan traded deadly air strikes on militant targets on each other's territory.