The usual way programmers deal with this is by chosing names like stack_push and queue_push so that collisions are unlikely.
To manage this more cleanly, C++ introduced the namespace, which is just a collection of names for functions (and classes and all the other stuff you name). That is, instead of throwing all the names in one bucket, you can have as many buckets as you need, each called a namespace, and which in turn has a name. We've already encountered the namespace std which contains all the standard library declarations.
To solve the stack/queue problem, you might have a namespace stack, and another queue. You can then use the name push for each function, and write stack::push or queue::push when there's any ambiguity.