Numerous statistical and data-driven modeling frameworks have estimated rear-end crashes and crash-prone events from macroscopic traffic states which are at the heart of traffic flow modelling and control. However, existing frameworks focus on critical events and exclude a vast majority of safer interactions, which are essential information with respect to identifying the trade-offs between congestion management and rear-end crash prevention. This study proposes a flexible conflict-based framework to extract safety information from freeway macroscopic traffic state variables (i.e., speed and density) by utilizing the information from all underlying car-following interactions. Time spent in conflict (TSC) is introduced as the total time spent by all vehicles in rear-end conflicts based on a given conflict measure and a threshold to be determined flexibly. Using the NGSIM vehicle trajectory dataset, we show that the proportion of stopping distance (PSD) is more desirable than several event-based conflict measures (e.g., time to collision) for describing TSC based on macroscopic state variables. Besides, it is shown that PSD provides explicit safety information about the entire travel time for each macroscopic state because it applies to all car-following interactions. This paper proposes a hybrid methodological framework combining probabilistic and machine learning models to develop the relationships between safety and macroscopic state variables within a flexible conflict-based safety assessment framework. At first, probabilistic and Machine learning models are separately developed to estimate PSD-based TSC using only macroscopic stte variables. Each approach is evaluated comprehensively against empirical observations using the NGSIM vehicle trajectory dataset. While the machine learning approach has better predictive accuracy for a fixed rear-end conflict threshold (i.e., PSDcr), the probabilistic approach has a better explaining capability and captures TSC using flexible conflict thresholds. Utilizing the advantages of these two approaches, the proposed hybrid framework satisfactorily predicts TSC corresponding to PSD