How do you choose the right type of sensor for a specific application?

When choosing a sensor, what influences your decision the most? Do you look at factors like accuracy, response time, range, or cost first? I’d love to hear how others approach this, especially when working in challenging environments where things like temperature or humidity fluctuate.