The Markit/CIPS manufacturing Purchasing Managers' Index grew to 50.1 from 49.4 in April, which had been the lowest reading since early 2013.
The 50 mark separates manufacturing growth from contraction, with the sector now just on the positive side.
Manufacturing failed to boost overall UK growth during 2015 and early 2016.
UK economic growth slowed to 0.4% in the first quarter of the year from 0.6% in late 2015, propped up by the services sector.
Rob Dobson, senior economist at survey compilers Markit, said: "The manufacturing sector looks likely to act as an increased drag on the economy in the second quarter.
"There are also signs that increased client uncertainty resulting from slower growth and the forthcoming EU referendum are weighing on investment spending and business decision-making in general."
The report found that more than a third of manufacturers surveyed believed uncertainty over the EU vote has had an impact on their business, with 8% saying the effect was "strongly detrimental".
The survey showed the investment goods industry experienced a difficult month, with production falling at the quickest pace since early 2013.
Howard Archer, chief UK and European economist at IHS Global Insight, said the manufacturing sector was "essentially at a standstill in May".
Ruth Miller, UK economist at Capital Economics, said the small improvement for manufacturing in May did little to change the fundamental picture of a struggling industrial sector.
"Granted, the headline PMI index recovered from its three-year low in April, ticking up from an upwardly revised 49.4 to 50.1 in May, above the consensus expectation of 49.6," she said.
Ms Miller said this was still far below the average since the economic recovery picked up at the start of 2013. However, she thought the situation would "improve for UK manufacturers later this year".
Overall new orders rose in May.
Meanwhile, some firms said they were already pricing in the expectation that inflation will rise. Annual consumer price inflation currently stands at 0.3%.

The poverty rate was 15% in 2011, meaning 46.2 million Americans were in poverty, staying flat after three previous years of increases.
Real median income of households in the country dropped by 1.5%.
The average poverty threshold for a family of four in 2011 was $23,021 (Â£14,300).
Income inequality, as measured by the Gini index, increased by 1.6% in 2011, the first time there has been an annual rise in the index since 1993.
The percentage of Americans lacking health insurance fell to 15.7% from 16.3%, the report also said.
Poverty in the US reached a record high in 2010, at 15.1%.

The facility, based on the town's Crichton estate, is due to open in the next 12 months.
The centre will be used primarily to research ways to improve responses to weather-related emergencies such as flooding.
A report to the council's policy and resources committee will give a full update on progress to date.
Initially the facility will have up to six staff.
Last month, the Scottish government gave assurances that plans to develop the centre remained on track.
It followed concerns from Dumfriesshire Labour MSP Elaine Murray about the pace of progress on the project, since it was first announced in August last year.
A report to the council says it is essential the renewed impetus is maintained.
To that end working groups are being set up, and council and government officials are exploring the best location and office arrangements for the centre.

NHS Digital confirmed so many NHS staff use the search engine that it had started asking them to take a quiz to verify they were "not a robot".
News site the Register reported one NHS Trust had told staff to "use Bing" instead.
Google indicated its systems were designed to spot unusual traffic and were working as intended.
Detecting suspicious traffic from one network can help defeat potential cyber-attacks, such as attempts to try to overwhelm a website.
The BBC understands Google is not deliberately singling out NHS traffic.
A Google spokeswoman said: "Our systems are simply checking that searches are being carried out by humans and not by robots in order to keep web users safe. Once a user has filled out the Captcha [security check], they can continue to use Google as normal."
The NHS is one of the biggest employers in the world, with more than a million members of staff.
An email sent by an NHS system administrator suggested the number of staff using the search engine was "causing Google to think it is suffering from a cyber-attack".
NHS Digital told the Register: "We are aware of the current issue concerning NHS IP addresses which occasionally results in users being directed to a simple verification form when accessing Google.
"We are currently in discussion with Google as to how we can help them to resolve the issue."
NHS Digital was unable to suggest what NHS staff may be searching for using Google.
UK manufacturing activity rose slightly in May, raising concerns over the economy's strength in the run-up to the 23 June European Union referendum.
[NEXT_CONCEPT]
The percentage of Americans living in poverty is statistically unchanged from 2010's record high, even as household income fell, a US Census report says.
[NEXT_CONCEPT]
Councillors are to be given a progress report on plans to develop a national resilience centre in Dumfries.
[NEXT_CONCEPT]
NHS staff using Google's search engine has triggered one of its cybersecurity defences.