Updated:

Common causes

Narrow it down

/say test
/execute if entity @e[type=minecraft:zombie] run say zombie found
/execute if entity @e[distance=..10] run say nearby entity found

Start loose. When something is found, add type, distance, name and so on one by one.

Arguments to check

Targets in unloaded areas

Entities in unloaded chunks cannot be selected. On Java, /forceload keeps an area loaded.

Which message is which

MessageMeaning
No entity was foundJava: nothing matches @e, @s and similar
No player was foundJava: no player matches @p, @a or a name
No targets matched selectorBedrock: nothing matches

All three mean "valid syntax, no target". A syntax mistake shows a red error instead; see unknown or incomplete command.

Dead or offline players

Players on the respawn screen are not selected by @p or @e, only by @a. If a minigame skips some players, check whether they were dead. Names of players who are not online are not found either.

Java vs Bedrock

Bedrock uses r and rm instead of distance, and c instead of limit. Java selectors pasted into Bedrock give a syntax error. The converter rewrites them.

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.