The people were kidnapped on December 22 by fighters posing as soldiers who stopped a convoy of commercial vehicles travelling towards the city of Maiduguri, state capital of the northeast state of Borno.
Armed groups have waged an uprising in northeast Nigeria that has killed at least 35,000 people since 2009 and left 7.1 million in need of humanitarian assistance.
Boko Haram, a group seeking a separate state in northeast Nigeria adhering to a strict interpretation of Islamic laws, began the unrest.
"I am deeply relieved that some civilians, including three aid workers, who were abducted by non-state armed groups along the Monguno - Maiduguri road on 22 December 2019 have been released yesterday and are now safe," Edward Kallon, the UN humanitarian coordinator in Nigeria, said in a statement on Thursday.
Kallon said he was concerned about the "increasingly insecure environment that humanitarians are working in". He said a total of 12 aid workers lost their lives in 2019, more than twice the 2018 total, making it one of the most dangerous years for humanitarian actors in Nigeria.
According to AFP news agency, citing security sources and one of the freed hostages, a total of five aid workers were released on Wednesday, after they were seized in two separate incidents in December.
Asabe Musa, a hygiene specialist with ALIMA (Alliance for International Medical Action), a French NGO, was among those freed.
Musa told AFP news agency that those captured were another colleague from ALIMA, a Red Cross worker, a member of NGO Solidarity and one person from the International Office for Migration.
The UN did not state whether those behind the abduction were associated with Boko Haram or a faction that broke away in 2016 and pledged allegiance to the ISIL (ISIS) group.
The group - Islamic State in West Africa Province (ISWAP) - has been the dominant armed group in Nigeria in the last two years.
ISWAP in December said it executed 11 Christian captives it had previously kidnapped in Borno State.
A security source told AFP that the fighters who released the hostages were from ISWAP.
In his statement on Thursday Kallon also expressed concern for aid worker Grace Taku and nurse Alice Loksha, who were abducted in July 2019 and March 2018 respectively and are still being held.