JS value to PHP variable to change div background color with PHP If else statement

PHP can’t read JavaScript variables – that’s because they are simply not available at the point that PHP is run.

So, in this case, you are better staying with pure JavaScript to accomplish what is really a UI challenge – it will also make your code cleaner and better organised.

Here is a basic ( untested ) solution:

<script>
    $( function() {
       
       color="red"; // default ##
       if ( '7' >= reviewsOverall ){
        
           color="blue";
           
       } elseif ( '7' < reviewsOverall ){
        
           color="pink";
           
       }

       $('.rwp-users-score').css('background-color', color );

    });
</script>

This script could be added inline on the template or added to a scripts.js file and included using wp_enqueue_script()https://developer.wordpress.org/reference/functions/wp_enqueue_script/