Yes. Here are some ways.
With just vanilla Emacs you can narrow the buffer to the text between your two "markers", using C-x n n. You need only one marker - the mark, at one end of that bit of text, and point (the cursor position) at the other end of that bit of text.
With library Isearch+ you can just search the active region - no need to narrow the ...
To invoke a function, don't quote it: (kill-whole-line), not ('kill-whole-line).
You're looking for function use-region-p, so (use-region-p), not region-selected. (There is no predefined variable region-selected.)
You need to pass functions the arguments they require. So (kill-region (region-beginning) (region-end).
If you want it to be a function then ...