If the queue is implemented as a circular buffer, as, for example the .NET Queue
class is, then that's still an O(1) operation, even if you're both adding one item to the end and removing one item from the head. Being a circular buffer it won't need to move all of the items, it simply need to adjust two integer indexes representing where the start/end of the queue is within the buffer.
On top of that, if there's a capacity of 5 then you can say that even if you did need to move all of the items, you are never moving more than 5. Everything is O(1) when n is small. Big O is only relevant when 'n' can scale to large numbers.