Since you didn't specify a country, I will answer in the context of the United States.
Here are some example sentences you could use to determine if the restaurant has a to go/take out option:
- "Hi, can I order something to go?"
- "Do you have carry-out options?" (can also replace with take-out or to go)
- "Can I get this to go?" (if you have already started the ordering process)
As far as ordering online, that depends on a case-by-case basis, but usually the website would have a set of buttons or other menu choice where you can explicitly specify whether you'd rather have your food delivered or available for pick-up at the restaurant location. If for some reason they required you to type a phrase, something like "I would like to pick this up at the restaurant please" would clearly convey your intention.
An additional note:
It is common that when a live person is taking your order over the phone or across a counter, they will have a set of questions they will ask, often including a prompt of whether you want your food to go.
- "Dine-in or take-out?" (in-person)
- "Is this for here or to go?" (in-person)
- "Is this for delivery or pickup?" (over the phone)