Which version of the IDE are you using? There have been some changes to the servo library for various versions of the IDE.
Why are you flushing the serial buffer?
In the motor function, there are cases for 48, 49, 50. Strange numbers for the cases. What do they mean? '0', '1', and '2' would make a lot more sense. Even better, though, would have been to subtract '0' from all the values before calling the motor function, passing it 0, 1, or 2.
Better than that, though, would be to add these to the top of the code
#define STOP 0
#define RIGHT 1
#define LEFT 2
and use these in the case statements.
Whatever you do, make the comments match the code. Much easier to debug when the code matches the comments.
In loop, you check that there is serial data available each time before read. That's good. But, suppose there is a slowdown in serial communication. You check that there is a byte for selection. There is, so you read it. Then, you check for a byte for pos. There is, so you read it. Then, you check for a byte for pos. Suppose there isn't. You skip reading a value for pos, which stays NULL. The byte has arrived by now, so you read it into pos.
What was supposed to be something like s72 has become 's', '7', NULL, '2'.
You then take action based in 's', '7'.
Whatever is sending data should send something like '<', 's', '7', '2', '>'. Now the string has a defined start and stop value, and you can read the data in a (much shorter) while loop, storing the characters between the '<' and the '>' in adjacent positions in an array. Knowing that the first character is a character, and that subsequent characters are digits also allows you to ignore invalid data.
Garbled transmissions, like '<', 's', '7', '&', '<', 's', '8', '4', '>' can be handled correctly.