Footage verified by the BBC shows a group of men stripped to their underwear, kneeling on the ground and being guarded by Israeli soldiers.
The man says he was forced to sit in the street for hours, handcuffed and blindfolded, before being driven away.
An Israeli official said the soldiers were searching for Hamas members.
Mark Regev, a senior adviser to Prime Minister Benjamin Netanyahu, told the BBC they were looking for those "responsible for the massacre of October 7".
The detainees were taken by truck from Beit Lahia in northern Gaza to an unknown place, according to the young man - who asked to remain anonymous for his safety.
Once they arrived, they were randomly selected for questioning and interrogated about their relationship with Hamas, he adds.
One image - which has not yet been verified by the BBC - shows men blindfolded, kneeling in what appears to be a large pit of bulldozed sand.
The 22-year-old says the place that he, his father, brother and five cousins were taken to was sandy - and they were left there almost naked but given a blanket at night.
After questioning, he says he was taken to another location before being told to go home, arriving at around 01:40 in the morning.
"They released all of us, except my father and eldest cousin. My father works for UNRWA. I don't know why they took him," he said.
"We walked barefoot down the street in the dark, with the roads full of rocks and glass."
UNRWA is the UN agency that supports Palestinian refugees.
A picture of the men being driven away in a truck, verified by the BBC, has been circulating on social media
Mr Regev said IDF troops had been gathering people to find out who was responsible for the Hamas attacks in Israel.
They were trying to determine "whose name and face fits with the photographs of people beheading people, or raping women and so forth", he said.
Mr Regev claimed it was possible that some were UN workers, but suggested that did not "automatically" mean they were not also Hamas members.
He said Hamas controlled the workers' union of UNRWA and that the group had "activists in all sorts of organisations, that shouldn't come as a surprise to anyone".
A second Palestinian, Mohammed Lubbad, who lives in Belgium, said on Instagram that his brother Ibrahim was detained along with 10 other family members.
Mr Lubbad told the BBC he had video-called his brother on WhatsApp two hours before he was taken away.
"He told me that our house and the entire village in Beit Lahia were surrounded by Israeli forces," he said. "Later, I saw the video posted on social media [of the truck]. I immediately recognised my brother and also identified some of our neighbours."
Mr Lubbad said all his relatives were eventually released except for two cousins - Ahmed Lubbad, 35, a teacher and father-of-four, and Ayman Lubbad, a human rights activist and father-of-three.
He said his family were "innocent civilians with no military affiliation".
'Transferred to Israel'
One of the detained men, Diaa al-Kahlout - who has not been released yet, according to a colleague - is a correspondent for The New Arab, or Al-Araby Al-Jadeed, a London-based pan-Arab outlet.
Some of those later released told al-Kahlout's family that the journalist had been transferred to Zikim military base in Israel, according to Lamis Andoni of The New Arab.
Diaa al-Kahlout faced "humiliating treatment", his employer Al-Araby al-Jadeed says
"We have no idea about his fate," she told BBC Radio 4's PM programme. "The photos and videos of these men are horrifying. I'm shocked."
Describing Mr al-Kahlout as very ambitious, she said he "always had a smile on his face, but like many Gazans, felt suffocated".
Ms Andoni said her outlet was speaking to Israeli forces through the UN. She said the IDF's suggestion the men were just suspects and that forces needed to investigate them was "not a good answer".
By Ethar Shalaby & Shereen Youssef