Iran’s president and foreign minister dropped hints on Friday of movement toward a resolution in the fates of Americans imprisoned or missing in Iran.

The president, Hassan Rouhani, who was visiting New York for the annual United Nations General Assembly, told guests at an invitation-only meeting in a nearby hotel that he wanted the governments of Iran and the United States “to be helpful” in finding a solution.

Around the same time, in an impromptu encounter with an American congressman in the General Assembly hall, the foreign minister, Mohammad Javad Zarif, said he was hopeful that the prisoner issue could be resolved, according to Representative Dan Kildee, Democrat of Michigan.

Mr. Kildee, who was there to hear a speech by Pope Francis, said he had approached Mr. Zarif, who was sitting at the Iran delegation’s table.