Conceptually, orders arrive at the exchange and are processed one at a time. The fate of your order depends on the previous orders which are on the books when yours is processed. So what matters is the state of the market at the instant when your order "arrives" at the exchange. There will of course be some delay between the instant at which you place the order and the instant when it arrives at the exchange. The length of this delay would depend on internet latency, the speed of the exchange's computers, etc.
If you place a limit order, then the price will be whatever you wanted it to be. The order will be filled if there is a matching order already on the books at the instant of arrival; otherwise your order will be placed on the books and may or may not be filled by some later order.
If you place a market buy (/ sell) order, the price will be whatever the lowest ask (/ highest bid) is on the books at the instant of arrival. Of course, this could be a different price than what you saw when you placed the order. That's an inherent risk of market orders.