Unity mobile, separating canvas and world space inputs

public class VirtualJoystick : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler {

    private Image bgImg;
    private Image joystickImg;

    public Vector3 InputDirection { set; get; }

    private void Start() {
        bgImg = GetComponent<Image>();
        joystickImg = transform.GetChild(0).GetComponent<Image>();
    }

    public virtual void OnDrag(PointerEventData ped) {

        Vector2 pos = Vector2.zero;
        if(RectTransformUtility.ScreenPointToLocalPointInRectangle(
            bgImg.rectTransform,
            ped.position,
            ped.pressEventCamera,
            out pos)) {
            pos.x = pos.x / bgImg.rectTransform.sizeDelta.x;
            pos.y = pos.y / bgImg.rectTransform.sizeDelta.y;

            float x = (bgImg.rectTransform.pivot.x == 1) ? pos.x * 2 + 1 : pos.x * 2 - 1;
            float y = (bgImg.rectTransform.pivot.y == 1) ? pos.y * 2 + 1 : pos.y * 2 - 1;

            InputDirection = new Vector3(x, y, 0.0f);

            if(InputDirection.magnitude > 1.0f) {
                InputDirection = InputDirection.normalized;
            }


            joystickImg.rectTransform.anchoredPosition =
                new Vector3(InputDirection.x * (bgImg.rectTransform.sizeDelta.x / 3)
                , InputDirection.y * (bgImg.rectTransform.sizeDelta.y / 3));
        }
    }

    public virtual void OnPointerDown(PointerEventData ped) {
        OnDrag(ped);
    }

    public virtual void OnPointerUp(PointerEventData ped) {
        InputDirection = Vector3.zero;
        joystickImg.rectTransform.anchoredPosition = Vector3.zero;
    }
}

I’m using the code you see above, and have placed a simple virtual joystick img on my canvas.
I want the player to be able to touch the game field and do something (i.e. click on an object, or use some other collider/trigger placed in the world) without having to let go of the virtual joystick.

How would I go about separating these inputs?

canvas/
    virtual_joystick/  #this is where the code is attached
        // sprites here

If your game field consists of typical 2D/3D objects (meaning not based on Unity UI) then using a separate script that raycasts on touch input should solve this situation (you should probably handle if you touch the virtual joystick with a second touch).

If your game field consists of Unity UI elements, then possibly EventTrigger.OnPointer… functions will help (e.g. OnPointerEnter, OnPointerDown, etc.).