Draw on top of collider handles in editor

Example code that draws a line on top of the top of a BoxCollider2D in a custom editor:

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(SomeBehaviour))]
public class SomeInspector : Editor
{
    public void OnSceneGUI()
    {
        var bounds = ((SomeBehaviour)target).GetComponent<BoxCollider2D>().bounds;
        float z = 0f;
        Handles.color = Color.blue;
        Handles.DrawLine(new Vector3(bounds.min.x, bounds.max.y, z), new Vector3(bounds.max.x, bounds.max.y, z));
    }
}
using UnityEngine;

[RequireComponent(typeof(BoxCollider2D))]
public class SomeBehaviour : MonoBehaviour
{
}

Draws on top of gizmos wireframe as it should regardless of component order:

Does not draw on top of handles in edit mode if BoxCollider2D is placed below SomeBehaviour:

How can I draw on top of handles in edit mode regardless of component order?

In the editor, subscribe to SceneView.onSceneGUIDelegate/SceneView.duringSceneGui. It is called after OnSceneGUI and OnToolGUI, meaning it will draw on top of both.

using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(SomeBehaviour))]
public class SomeInspector : Editor
{
    public void OnEnable()
    {
        SceneView.onSceneGUIDelegate += OnAfterSceneGUI;
    }

    public void OnDisable()
    {
        SceneView.onSceneGUIDelegate -= OnAfterSceneGUI;
    }

    public void OnAfterSceneGUI(SceneView sceneView)
    {
        var bounds = ((SomeBehaviour)target).GetComponent<BoxCollider2D>().bounds;
        float z = 0f;
        Handles.color = Color.blue;
        Handles.DrawLine(new Vector3(bounds.min.x, bounds.max.y, z), new Vector3(bounds.max.x, bounds.max.y, z));
    }
}