Improve performance by combining two quieries
Can it be?

select distinct s2.user_name 
from submission s1
  join submission s2 
    on s1.md5 = s2.copy_of 
    or s1.copy_of = s2.copy_of 
    or s1.copy_of = s2.md5
where s1.user_name = ?1 
 and s2.copy_of is not null;


s1.md5 = s2.copy_of will match submission which is copy from this user.
s1.copy_of = s2.copy_of or s1.copy_of = s2.md5 will match submission which current user copy from.