Due to a rising share of renewable energy sources on the production side and electrification of transport and heating on the consumption side, the efficient management of flexibility in distribution networks is crucial for ensuring optimal operation and utilization of resources. Nowadays, the sensitivity-based approach is mainly used in medium-voltage (MV) networks for regulating voltage profiles with reactive power of distributed energy resources (DER). The main disadvantage of the simplified sensitivity-based method is its inaccuracy in case of a high deviation of the network voltage from the nominal values. Furthermore, it was also noted that despite the fact that the method is well described in the literature, there is a lack of systematic approach to its implementation in real-life applications. Thus, the main objective of this paper is to address this disadvantage and to propose an algorithm designed to calculate required consumer flexibility in near real-time to ensure distribution grid operation within operational criteria. In the first part of the paper, network state, including line loading and node voltages, is assessed to determine distribution network node capacity. By analyzing the sensitivity of network busbars to changes in consumption and production, our algorithm effectively identifies the most efficient nodes and facilitates strategic decision-making for resource allocation. We demonstrate the effectiveness of our approach through simulations of real-world distribution network data, highlighting its ability to enhance network flexibility and improve resource utilization. Leveraging sensitivity coefficients, the algorithm enables flexible consumption and production management across various scenarios, supporting the transition to a more dynamic and efficient power system.