Is it ever ambiguous if 几 means "how many?" or "a few"? I'm confused about hao to know if 几 is asking a question (how many) or making a statement (a few). If I heard the following sentence (not read), is there a way to hear the difference?

从上海到东京坐飞机要几个小时
It depends on your tone and context.

If the statement itself does not have any prior or future statements, then it would likely be a question.
Here are the possible context：

从上海到东京坐飞机要几个小时 ？ In this case, you are asking a question， your tone would also be in an inquiring manner, to make it clear its a question

从上海到东京坐飞机要几个小时, 你总不能要我每天来回吧？ In this case its a statement (It takes a couple hours from Shanghai to Tokyo, you can't expect me to travel between them everyday ?）