In ArcCatalog provide a reporting tool that lists which maps the layers are used, include the source. This will help clean up databases especially with legacy data. The following code will list the layers but it should pull the data source as well.
import arcpy
# Reference the current project
aprx = arcpy.mp.ArcGISProject("CURRENT")
# Loop through all maps in the project
for m in aprx.listMaps():
print(f"Map: {m.name}")
# Loop through all layers in the map
for lyr in m.listLayers():
# Only print valid layers (ignores group headers)
if lyr.isFeatureLayer or lyr.isRasterLayer:
print(f" - Layer: {lyr.name}")