Upvote:3
The bus must stop at the border. When that happens, a custom offer goes through the bus asking to see each person's passport. Canadians get let though without further process but almost everyone else is told to get off the bus to line up at immigration counters inside. If for some reason they do not ask you to get out of the bus, that is the time to hand in your form. Otherwise, you will be asked for it at immigration.
See this question if you forget to return the form or for some reason, it happens differently.