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%.
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.