This example assumes you are using Unity, other game engines might work differently although the concept still applies.
You could to use RaycastAll and check the position of the platform.
This function is similar to the Raycast function but instead of detecting just the first Collider that is hit, an array of all Colliders along the path of the ray is returned.
Create a Tag named something like "Platform" and add it to the platform game object.
Then in code use the above mentioned raycast to check all game objects in the desired direction and check if any are tagged as Platform.
If it's tagged Platform then check its position relative to the origin of the raycast.
Now that you know if its below or above you can act accordingly.
//script on a "player" game object
var hits = Physics2D.RaycastAll(transform.position, Vector2.up, 10);
foreach (var hit in hits)
{
if (hit.transform.CompareTag("Platform"))
{
if (transform.position.y > hit.transform.position.y)
{
Debug.Log(hit.transform.gameObject);
}
}
else
{
//if its not a platform do something else
Debug.Log(hit.transform.gameObject);
}
}
The player is represented by the triangle and the raycast is pointing up.

Now the player is above the platform and the raycast is pointing down.
