The numbers are merely unique identifiers for each banknote. They contain information about when and where the note was printed and I think they have some error-detection encoding to make them more difficult to create forgeries.
Think about it. Every note has a unique number, so if they were NI numbers then why would some people be worth £5 and others £20. There are also more than 2 billion UK notes in circulation, all with a unique serial number - far more than the number of people in the country.
The US system is the same, the serial number denotes where and when the note was printed. Any connection to particular people's SS numbers is purely coincidental.
Skeptical but Curious
a) The opinions presented in this post are my own. I speak for nobody but myself
b) I am not and have never been a government employee
c) If you consider part b) to be proof of its contrary, you are a silly person
d) Part c) is also my opinion