Two common approaches
A filter may compare requested addresses with a maintained list of permitted or restricted sites. Another approach examines page text, images or other signals as content is requested.
Neither method is perfectly neutral or reliable. Lists can be outdated, while automated classification can misunderstand context, educational discussion or unfamiliar terminology.