wifi web server that doesn't slow down a robot?

Is there any difference between me having put the web server code in a function, and calling up the function in the main loop

Not really and it makes your code cleaner. There is overhead associated with calling a function but it's negligible. If you get to the point where that overhead is a problem, there's always the 'inline' directive to get the best of both worlds.